Manually Build Selected Docker Images #2
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: Manually Build Selected Docker Images | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: "Branch to build from" | |
| required: true | |
| default: "main" | |
| debug_version: | |
| description: "Enter the release version tag (e.g. 0.9.30). The built image will be tagged as xxx:0.9.30-amd64." | |
| required: true | |
| archs: | |
| description: "Target architectures (comma separated), e.g. linux/amd64,linux/arm64" | |
| required: false | |
| default: "linux/amd64" | |
| build_gotrue: | |
| description: "Build GoTrue image" | |
| type: boolean | |
| required: false | |
| default: false | |
| build_appflowy_cloud: | |
| description: "Build AppFlowy Cloud image" | |
| type: boolean | |
| required: false | |
| default: true | |
| build_admin_frontend: | |
| description: "Build Admin Frontend image" | |
| type: boolean | |
| required: false | |
| default: false | |
| build_appflowy_worker: | |
| description: "Build AppFlowy Worker image" | |
| type: boolean | |
| required: false | |
| default: true | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-22.04 | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - name: Set up architecture matrix | |
| id: set-matrix | |
| run: | | |
| # Convert comma-separated archs to JSON array and extract arch names | |
| archs="${{ github.event.inputs.archs }}" | |
| # Replace linux/ prefix and convert to JSON array | |
| matrix_archs=$(echo "$archs" | sed 's/linux\///g' | sed 's/,/","/g' | sed 's/^/["/' | sed 's/$/"]/') | |
| echo "matrix={\"arch\":$matrix_archs}" >> $GITHUB_OUTPUT | |
| echo "Generated matrix: {\"arch\":$matrix_archs}" | |
| gotrue: | |
| runs-on: ubuntu-22.04 | |
| needs: setup | |
| if: ${{ github.event.inputs.build_gotrue == 'true' }} | |
| strategy: | |
| matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Build and push GoTrue image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./docker/gotrue/Dockerfile | |
| platforms: linux/${{ matrix.arch }} | |
| push: true | |
| tags: | | |
| appflowyinc/gotrue:${{ github.event.inputs.debug_version }}-${{ matrix.arch }}-internal | |
| - name: Logout from Docker Hub | |
| if: always() | |
| run: docker logout | |
| appflowy_cloud: | |
| runs-on: ubuntu-22.04 | |
| needs: setup | |
| if: ${{ github.event.inputs.build_appflowy_cloud == 'true' }} | |
| strategy: | |
| matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Build and push AppFlowy Cloud image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| platforms: linux/${{ matrix.arch }} | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_cloud:${{ github.event.inputs.debug_version }}-${{ matrix.arch }}-internal | |
| provenance: false | |
| build-args: | | |
| PROFILE=release | |
| - name: Logout from Docker Hub | |
| if: always() | |
| run: docker logout | |
| admin_frontend: | |
| runs-on: ubuntu-22.04 | |
| needs: setup | |
| if: ${{ github.event.inputs.build_admin_frontend == 'true' }} | |
| strategy: | |
| matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Build and push Admin Frontend image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./admin_frontend/Dockerfile | |
| platforms: linux/${{ matrix.arch }} | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKER_HUB_USERNAME }}/admin_frontend:${{ github.event.inputs.debug_version }}-${{ matrix.arch }}-internal | |
| provenance: false | |
| build-args: | | |
| PROFILE=release | |
| - name: Logout from Docker Hub | |
| if: always() | |
| run: docker logout | |
| appflowy_worker: | |
| runs-on: ubuntu-22.04 | |
| needs: setup | |
| if: ${{ github.event.inputs.build_appflowy_worker == 'true' }} | |
| strategy: | |
| matrix: ${{ fromJson(needs.setup.outputs.matrix) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: ${{ github.event.inputs.branch }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| - name: Build and push AppFlowy Worker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./services/appflowy-worker/Dockerfile | |
| platforms: linux/${{ matrix.arch }} | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKER_HUB_USERNAME }}/appflowy_worker:${{ github.event.inputs.debug_version }}-${{ matrix.arch }}-internal | |
| provenance: false | |
| build-args: | | |
| PROFILE=release | |
| - name: Logout from Docker Hub | |
| if: always() | |
| run: docker logout |