Joysafeter v2 #539
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: Docker Build CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| jobs: | |
| # ============================================================================= | |
| # Main application images (backend, frontend) | |
| # Build only (no push) — release.yml handles publishing versioned images | |
| # ============================================================================= | |
| build: | |
| name: Build Docker Images | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| image: | |
| - name: joysafeter-backend | |
| context: ./backend | |
| dockerfile: ./deploy/docker/backend.Dockerfile | |
| - name: joysafeter-frontend | |
| context: ./frontend | |
| dockerfile: ./deploy/docker/frontend.Dockerfile | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ${{ matrix.image.context }} | |
| file: ${{ matrix.image.dockerfile }} | |
| platforms: linux/amd64,linux/arm64 | |
| push: false | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| GIT_COMMIT_SHA=${{ github.sha }} | |
| PIP_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple | |
| UV_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple | |
| # ============================================================================= | |
| # Sandbox image (independent, only triggered when sandbox files change) | |
| # Build only (no push) — release.yml handles publishing versioned images | |
| # ============================================================================= | |
| check-sandbox-changes: | |
| name: Check Sandbox File Changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| sandbox_changed: ${{ steps.filter.outputs.sandbox }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check for sandbox file changes | |
| uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| sandbox: | |
| - 'deploy/docker/sandbox.Dockerfile' | |
| - 'deploy/docker/configs/**' | |
| - 'deploy/docker/entrypoint.sh' | |
| build-sandbox: | |
| name: Build Sandbox Image | |
| runs-on: ubuntu-latest | |
| needs: check-sandbox-changes | |
| if: | | |
| needs.check-sandbox-changes.outputs.sandbox_changed == 'true' || | |
| github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Sandbox image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./deploy/docker | |
| file: ./deploy/docker/sandbox.Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: false | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |