mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-18 01:42:10 +08:00
48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
name: build-publish
|
|
|
|
on:
|
|
# run it on push to the default repository branch
|
|
push:
|
|
branches: [develop]
|
|
# run it during pull request
|
|
pull_request:
|
|
|
|
jobs:
|
|
# define job to build and publish docker image
|
|
build-and-push-docker-image:
|
|
name: Build Docker image and push to repositories
|
|
# run only when code is compiling and tests are passing
|
|
runs-on: ubuntu-latest
|
|
|
|
# steps to perform in job
|
|
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: Login to Github Packages
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
- name: Build image
|
|
run: |
|
|
# docker build -t meysamh66/booking-microservices/flight:latest -f ./src/Services/Flight/Dockerfile .
|
|
docker build . -t ${{ env.REGISTRY }}/${{ github.repository }}/flight:latest -f "${{ github.workspace }}/src/Services/Catalogs/Flight/Dockerfile ."
|
|
|
|
|
|
- name: Publish image
|
|
run: |
|
|
docker push "${{ env.REGISTRY }}/${{ github.repository }}/flight:latest}}"
|
|
# docker push meysamh66/booking-microservices/flight:latest
|
|
|
|
|