mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-05-02 10:52:53 +08:00
chore: Using reusable build and publish docker in ci.yml
This commit is contained in:
parent
6f30ddee97
commit
9991c9019e
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:
|
tag-name:
|
||||||
description: "Tag Name"
|
description: "Tag Name"
|
||||||
required: true
|
required: true
|
||||||
|
image-name:
|
||||||
|
description: "Image Name"
|
||||||
|
required: true
|
||||||
registry-username:
|
registry-username:
|
||||||
description: "Registry username"
|
description: "Registry username"
|
||||||
required: true
|
required: true
|
||||||
registry-password:
|
registry-password:
|
||||||
description: "Registry password"
|
description: "Registry password"
|
||||||
required: true
|
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
|
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-actions
|
||||||
runs:
|
runs:
|
||||||
@ -32,17 +38,11 @@ runs:
|
|||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
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 }}/${{ inputs.image-name }}:${{ inputs.tag-name }} -f "${{ github.workspace }}/${{ inputs.dockerfile-path }}" .
|
||||||
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" .
|
|
||||||
|
|
||||||
- name: Publish Docker Image
|
- name: Publish Docker Image
|
||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
docker push ${{ inputs.registry-username }}/booking-microservices-flight:${{ inputs.tag-name }}
|
docker push ${{ inputs.registry-username }}/${{ inputs.image-name }}:${{ 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 }}
|
|
||||||
|
|
||||||
|
|||||||
37
.github/workflows/ci.yml
vendored
37
.github/workflows/ci.yml
vendored
@ -45,11 +45,42 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Publish Identity to Docker
|
||||||
- name: Call Composite Action docker-build-publish
|
|
||||||
uses: ./.github/actions/docker-build-publish
|
|
||||||
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
if: ${{ github.ref == 'refs/heads/main' && success() }}
|
||||||
|
uses: ./.github/actions/docker-build-publish
|
||||||
with:
|
with:
|
||||||
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
tag-name: ${{ steps.last_release.outputs.tag_name }}
|
||||||
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
registry-password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
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