workflow
This commit is contained in:
parent
b660c53915
commit
77f6c56acb
1 changed files with 20 additions and 18 deletions
38
.github/workflows/docker-build.yml
vendored
38
.github/workflows/docker-build.yml
vendored
|
@ -3,33 +3,35 @@ name: Build and Push Docker Image
|
|||
on:
|
||||
push:
|
||||
paths:
|
||||
- alaskarfin/version.txt # Trigger workflow only when version.txt changes
|
||||
- version.txt # Trigger workflow only when version.txt changes
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
environment: Dockerhub # Use the Dockerhub environment
|
||||
|
||||
steps:
|
||||
# Step 1: Check out the repository
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Step 2: Log in to Docker Hub
|
||||
# Step 2: Set up Docker Buildx
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
# Step 3: Log in to Docker Hub
|
||||
- name: Log in to Docker Hub
|
||||
env:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
# Step 3: Build the Docker image
|
||||
- name: Build Docker Image
|
||||
run: |
|
||||
docker build alaskarfin -t nomadics/alaskarfin:latest -f alaskarfin/
|
||||
|
||||
|
||||
# Step 4: Push the Docker image to Docker Hub
|
||||
# - name: Push Docker Image
|
||||
# run: |
|
||||
# docker push nomadics/alaskarfin:latest
|
||||
# Step 4: Build and push the Docker image
|
||||
- name: Build and Push Image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ./alaskarfin # Path to the build context
|
||||
file: ./alaskarfin # Path to the Dockerfile
|
||||
push: true # Push the image to Docker Hub
|
||||
tags: |
|
||||
nomadics/alaskarfin:latest
|
||||
|
||||
|
|
Loading…
Reference in a new issue