This commit is contained in:
meysamhadeli 2023-01-24 22:57:46 +03:30
parent f3f71a1468
commit 0c97513fbd
2 changed files with 37 additions and 40 deletions

View File

@ -0,0 +1,37 @@
name: build-publish-docker
on:
push:
branches: [ develop ]
pull_request:
jobs:
build-and-push-docker-image:
name: Build and Publish Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build image
run: |
docker build -t meysamh66/booking-microservices-flight:latest -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" .
docker build -t meysamh66/booking-microservices-identity:latest -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" .
docker build -t meysamh66/booking-microservices-passenger:latest -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" .
docker build -t meysamh66/booking-microservices-booking:latest -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" .
- name: Publish image
run: |
docker push meysamh66/booking-microservices-flight:latest
docker push meysamh66/booking-microservices-identity:latest
docker push meysamh66/booking-microservices-passenger:latest
docker push meysamh66/booking-microservices-booking:latest

View File

@ -1,40 +0,0 @@
name: github-packages
on:
push:
branches: [ develop ]
pull_request:
jobs:
build-and-push-docker-image:
name: Build and Publish Docker image to Github Packages
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build image
run: |
docker build -t ghcr.io/${{ github.repository }}/flight:latest -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" .
docker build -t ghcr.io/${{ github.repository }}/identity:latest -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" .
docker build -t ghcr.io/${{ github.repository }}/passenger:latest -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" .
docker build -t ghcr.io/${{ github.repository }}/booking:latest -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" .
- name: Publish image
run: |
docker push ghcr.io/${{ github.repository }}/flight:latest
docker push ghcr.io/${{ github.repository }}/identity:latest
docker push ghcr.io/${{ github.repository }}/passenger:latest
docker push ghcr.io/${{ github.repository }}/booking:latest