mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-22 04:22:42 +08:00
48 lines
1.8 KiB
YAML
48 lines
1.8 KiB
YAML
name: build-publish-docker
|
|
|
|
on:
|
|
push:
|
|
branches: [ develop ]
|
|
pull_request:
|
|
|
|
jobs:
|
|
|
|
build-and-push-docker-image:
|
|
name: Build and Publish Docker image to DockerHub
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Extract version numbers
|
|
run: |
|
|
version=$(echo $GITHUB_REF | sed 's/refs\/tags\///')
|
|
major=$(echo $version | cut -d'.' -f1 | sed 's/v//')
|
|
minor=$(echo $version | cut -d'.' -f2)
|
|
patch=$(echo $version | cut -d'.' -f3)
|
|
echo "The major version number is $major"
|
|
echo "The minor version number is $minor"
|
|
echo "The patch version number is $patch"
|
|
|
|
- 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
|
|
|