fix: remove container_name and host ports to support scaling #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Push to DockerHub | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/**' | |
| - 'infra/**' | |
| - 'infra-pulumi/**' | |
| - 'worker/**' | |
| - 'producer/**' | |
| - 'dashboard-api/**' | |
| - 'dashboard-frontend/**' | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }} | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| service: | |
| - name: producer | |
| context: ./producer | |
| dockerfile: ./Dockerfile | |
| - name: worker | |
| context: ./worker | |
| dockerfile: ./Dockerfile | |
| - name: scheduler | |
| context: ./worker | |
| dockerfile: ./Dockerfile | |
| - name: dashboard-api | |
| context: ./dashboard-api | |
| dockerfile: ./Dockerfile | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and Push Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ${{ matrix.service.context }} | |
| file: ${{ matrix.service.context }}/${{ matrix.service.dockerfile }} | |
| push: true | |
| tags: | | |
| ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.service.name }}:${{ github.sha }} | |
| ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.service.name }}:latest | |
| build-and-push-frontend: | |
| runs-on: ubuntu-latest | |
| needs: build-and-push | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Build Frontend | |
| run: | | |
| cd dashboard-frontend | |
| pnpm install | |
| pnpm build | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ vars.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and Push Dashboard UI | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./dashboard-frontend | |
| file: ./dashboard-frontend/Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.DOCKERHUB_USERNAME }}/dashboard-ui:${{ github.sha }} | |
| ${{ env.DOCKERHUB_USERNAME }}/dashboard-ui:latest | |
| notify-success: | |
| needs: [build-and-push, build-and-push-frontend] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - name: Check Status | |
| run: | | |
| if [[ "${{ needs.build-and-push.result }}" == "success" ]]; then | |
| echo "All images built and pushed!" | |
| else | |
| echo "Build failed!" | |
| exit 1 | |
| fi |