diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..f4d3906 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,53 @@ +name: Build & Push All Services + +on: + push: + branches: + - main + - feat/build-ci-cd + workflow_dispatch: + +env: + REGISTRY: docker.io + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + service: + [ + auth, + event, + gateway, + location, + notification, + payment, + realtime, + reservation, + ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ env.DOCKERHUB_USERNAME }} + password: ${{ env.DOCKERHUB_TOKEN }} + + - name: Build and Push ${{ matrix.service }} service + uses: docker/build-push-action@v6 + with: + context: . + file: ./services/${{ matrix.service }}/Dockerfile + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.DOCKERHUB_USERNAME }}/${{ matrix.service }}-service:latest + ${{ env.REGISTRY }}/${{ env.DOCKERHUB_USERNAME }}/${{ matrix.service }}-service:${{ github.sha }} diff --git a/services/realtime/Dockferfile b/services/realtime/Dockerfile similarity index 100% rename from services/realtime/Dockferfile rename to services/realtime/Dockerfile