This commit is contained in:
nomadics9 2024-12-15 03:57:59 +03:00
parent b660c53915
commit 77f6c56acb

View file

@ -3,33 +3,35 @@ name: Build and Push Docker Image
on: on:
push: push:
paths: paths:
- alaskarfin/version.txt # Trigger workflow only when version.txt changes - version.txt # Trigger workflow only when version.txt changes
jobs: jobs:
build: build-and-push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: Dockerhub # Use the Dockerhub environment
steps: steps:
# Step 1: Check out the repository # Step 1: Check out the repository
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 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 - name: Log in to Docker Hub
env: uses: docker/login-action@v3
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} with:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} username: ${{ secrets.DOCKER_USERNAME }}
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin password: ${{ secrets.DOCKER_PASSWORD }}
# Step 3: Build the Docker image # Step 4: Build and push the Docker image
- name: Build Docker Image - name: Build and Push Image
run: | uses: docker/build-push-action@v6
docker build alaskarfin -t nomadics/alaskarfin:latest -f alaskarfin/ with:
context: ./alaskarfin # Path to the build context
file: ./alaskarfin # Path to the Dockerfile
# Step 4: Push the Docker image to Docker Hub push: true # Push the image to Docker Hub
# - name: Push Docker Image tags: |
# run: | nomadics/alaskarfin:latest
# docker push nomadics/alaskarfin:latest