Docker build CI/CD pipeline

This commit is contained in:
Nick1200000 2025-06-07 18:16:47 +05:30
parent add8c4e8a2
commit 020f6a123d

39
.github/workflows/docker-build.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Build and Push Docker Image
on:
push:
branches: [ main, master, enhancement/**, dev ]
pull_request:
branches: [ main, master, enhancement/**, dev ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push to GitHub Container Registry
run: |
docker build -t ghcr.io/${{ github.repository }}:latest .
docker push ghcr.io/${{ github.repository }}:latest
- name: Build and push to Docker Hub
run: |
docker build -t ${{ github.repository }}:latest .
docker push ${{ github.repository }}:latest