mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-18 01:42:10 +08:00
Merge pull request #169 from meysamhadeli/develop
chore: Using reusable build and publish docker in ci.yml
This commit is contained in:
commit
a633be1e6b
16
.github/actions/docker-build-publish/action.yml
vendored
16
.github/actions/docker-build-publish/action.yml
vendored
@ -7,12 +7,18 @@ inputs:
|
||||
tag-name:
|
||||
description: "Tag Name"
|
||||
required: true
|
||||
image-name:
|
||||
description: "Image Name"
|
||||
required: true
|
||||
registry-username:
|
||||
description: "Registry username"
|
||||
required: true
|
||||
registry-password:
|
||||
description: "Registry password"
|
||||
required: true
|
||||
dockerfile-path:
|
||||
description: "Dockerfile path"
|
||||
required: true
|
||||
|
||||
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions
|
||||
runs:
|
||||
@ -32,17 +38,11 @@ runs:
|
||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
docker build -t ${{ inputs.registry-username }}/booking-microservices-flight:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Flight/Dockerfile" .
|
||||
docker build -t ${{ inputs.registry-username }}/booking-microservices-identity:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Identity/Dockerfile" .
|
||||
docker build -t ${{ inputs.registry-username }}/booking-microservices-passenger:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Passenger/Dockerfile" .
|
||||
docker build -t ${{ inputs.registry-username }}/booking-microservices-booking:${{ inputs.tag-name }} -f "${{ github.workspace }}/src/Services/Booking/Dockerfile" .
|
||||
docker build -t ${{ inputs.registry-username }}/${{ inputs.image-name }}:${{ inputs.tag-name }} -f "${{ github.workspace }}/${{ inputs.dockerfile-path }}" .
|
||||
|
||||
- name: Publish Docker Image
|
||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||
shell: bash
|
||||
run: |
|
||||
docker push ${{ inputs.registry-username }}/booking-microservices-flight:${{ inputs.tag-name }}
|
||||
docker push ${{ inputs.registry-username }}/booking-microservices-identity:${{ inputs.tag-name }}
|
||||
docker push ${{ inputs.registry-username }}/booking-microservices-passenger:${{ inputs.tag-name }}
|
||||
docker push ${{ inputs.registry-username }}/booking-microservices-booking:${{ inputs.tag-name }}
|
||||
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:${{ inputs.tag-name }}
|
||||
|
||||
|
||||
37
.github/workflows/ci.yml
vendored
37
.github/workflows/ci.yml
vendored
@ -45,11 +45,42 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
||||
- name: Call Composite Action docker-build-publish
|
||||
uses: ./.github/actions/docker-build-publish
|
||||
- name: Build and Publish Identity to Docker
|
||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||
uses: ./.github/actions/docker-build-publish
|
||||
with:
|
||||
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
||||
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
dockerfile-path: 'src/Services/Identity/Dockerfile'
|
||||
image-name: 'booking-microservices-identity'
|
||||
|
||||
- name: Build and Publish Flight to Docker
|
||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||
uses: ./.github/actions/docker-build-publish
|
||||
with:
|
||||
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
||||
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
dockerfile-path: 'src/Services/Flight/Dockerfile'
|
||||
image-name: 'booking-microservices-flight'
|
||||
|
||||
- name: Build and Publish Passenger to Docker
|
||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||
uses: ./.github/actions/docker-build-publish
|
||||
with:
|
||||
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
||||
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
dockerfile-path: 'src/Services/Passenger/Dockerfile'
|
||||
image-name: 'booking-microservices-passenger'
|
||||
|
||||
- name: Build and Publish Booking to Docker
|
||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||
uses: ./.github/actions/docker-build-publish
|
||||
with:
|
||||
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
||||
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
dockerfile-path: 'src/Services/Booking/Dockerfile'
|
||||
image-name: 'booking-microservices-booking'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user