alaskartv-docker/.github/workflows/docker-build.yml
2024-12-15 03:44:17 +03:00

35 lines
972 B
YAML

name: Build and Push Docker Image
on:
push:
paths:
- alaskarfin/version.txt # Trigger workflow only when version.txt changes
jobs:
build:
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
- 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
# 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