feat: support custom Debian mirrors #22
Workflow file for this run
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: ci | |
| on: | |
| pull_request: | |
| paths: | |
| - "docker/**" | |
| - "scripts/**" | |
| - ".github/workflows/**" | |
| - "README.md" | |
| push: | |
| branches: [main] | |
| tags: ["*"] | |
| env: | |
| REGISTRY: ghcr.io/chaitin/monkeycode-runner | |
| # Use HTTP because the minimal base image lacks CA certificates before apt install. | |
| DEBIAN_MIRROR: http://mirrors.tuna.tsinghua.edu.cn/debian | |
| DEBIAN_SECURITY_MIRROR: http://mirrors.tuna.tsinghua.edu.cn/debian-security | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - stack: base | |
| version: bookworm | |
| - stack: devbox | |
| version: bookworm | |
| - stack: golang | |
| version: 1.25-bookworm | |
| - stack: frontend | |
| version: node20 | |
| - stack: rust | |
| version: 1.91-bookworm | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| STACK: ${{ matrix.stack }} | |
| VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ matrix.stack }} | |
| tags: | | |
| type=raw,value=${{ matrix.version }} | |
| type=raw,value=${{ matrix.version }}-${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/main' }} | |
| type=ref,event=tag | |
| type=raw,value=${{ matrix.version }}-${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
| - 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 GHCR | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build base (no push on PR) | |
| if: matrix.stack == 'base' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: docker/${{ matrix.stack }}/${{ matrix.version }}/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| DEBIAN_MIRROR=${{ env.DEBIAN_MIRROR }} | |
| DEBIAN_SECURITY_MIRROR=${{ env.DEBIAN_SECURITY_MIRROR }} | |
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
| - name: Build (no push on PR) | |
| if: matrix.stack != 'base' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: docker/${{ matrix.stack }}/${{ matrix.version }}/Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} |