Daily Docker Build #214
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: Daily Docker Build | |
| on: | |
| schedule: | |
| - cron: "0 16 * * *" # Run daily at 8:00am Pacific Time (UTC-8) | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| # Build AMD64 base image | |
| build-amd64-base: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set date | |
| id: date | |
| run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL | |
| df -h | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push AMD64 base image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: base | |
| platforms: linux/amd64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:base-amd64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:base-amd64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Prune Docker | |
| run: | | |
| docker system prune -af | |
| df -h | |
| # Build ARM64 base image | |
| build-arm64-base: | |
| runs-on: ubuntu-24.04-arm | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set date | |
| id: date | |
| run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL | |
| df -h | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push ARM64 base image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: base | |
| platforms: linux/arm64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:base-arm64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:base-arm64 | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Prune Docker | |
| run: | | |
| docker system prune -af | |
| df -h | |
| # Build AMD64 prebuilt image | |
| build-amd64-prebuilt: | |
| runs-on: ubuntu-latest | |
| needs: build-amd64-base | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set date | |
| id: date | |
| run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL | |
| df -h | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push AMD64 prebuilt image | |
| id: build-amd64 | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: prebuilt | |
| platforms: linux/amd64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:prebuilt-amd64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:prebuilt-amd64 | |
| cache-from: type=gha | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| - name: Build and push AMD64 artifacts image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: artifacts | |
| platforms: linux/amd64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:artifacts-amd64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:artifacts-amd64 | |
| cache-from: type=gha | |
| - name: Build & Push Run image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: run | |
| platforms: linux/amd64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:run-amd64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:run-amd64 | |
| cache-from: type=gha | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| # Build ARM64 prebuilt image | |
| build-arm64-prebuilt: | |
| runs-on: ubuntu-24.04-arm | |
| needs: build-arm64-base | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set date | |
| id: date | |
| run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL | |
| df -h | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push ARM64 prebuilt image | |
| id: build-arm64 | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: prebuilt | |
| platforms: linux/arm64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:prebuilt-arm64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:prebuilt-arm64 | |
| cache-from: type=gha | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| - name: Build and push ARM64 artifacts image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: artifacts | |
| platforms: linux/arm64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:artifacts-arm64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:artifacts-arm64 | |
| cache-from: type=gha | |
| - name: Build & Push Run image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| target: run | |
| platforms: linux/arm64 | |
| tags: | | |
| ghcr.io/${{ github.repository }}:run-arm64-${{ env.DATE }} | |
| ghcr.io/${{ github.repository }}:run-arm64 | |
| cache-from: type=gha | |
| build-args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| # Create multi-platform images | |
| create-multiplatform-images: | |
| needs: | |
| [ | |
| build-amd64-base, | |
| build-arm64-base, | |
| build-amd64-prebuilt, | |
| build-arm64-prebuilt, | |
| ] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set date | |
| id: date | |
| run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Create multi-platform base images | |
| - name: Create and push multi-platform base image | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ github.repository }}:base-${{ env.DATE }} \ | |
| -t ghcr.io/${{ github.repository }}:base \ | |
| -t ghcr.io/${{ github.repository }}:latest \ | |
| ghcr.io/${{ github.repository }}:base-amd64 \ | |
| ghcr.io/${{ github.repository }}:base-arm64 | |
| # Create multi-platform prebuilt images | |
| - name: Create and push multi-platform prebuilt image | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ github.repository }}:prebuilt-${{ env.DATE }} \ | |
| -t ghcr.io/${{ github.repository }}:prebuilt \ | |
| ghcr.io/${{ github.repository }}:prebuilt-amd64 \ | |
| ghcr.io/${{ github.repository }}:prebuilt-arm64 | |
| - name: Create and push multi-platform run image | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ github.repository }}:run-${{ env.DATE }} \ | |
| -t ghcr.io/${{ github.repository }}:run \ | |
| -t ghcr.io/${{ github.repository }}:latest \ | |
| ghcr.io/${{ github.repository }}:run-amd64 \ | |
| ghcr.io/${{ github.repository }}:run-arm64 | |
| # Create multi-platform artifacts images | |
| create-multiplatform-artifacts: | |
| needs: [build-amd64-prebuilt, build-arm64-prebuilt, create-multiplatform-images] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set date | |
| id: date | |
| run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Create and push multi-platform artifacts image | |
| run: | | |
| docker buildx imagetools create \ | |
| -t ghcr.io/${{ github.repository }}:artifacts-${{ env.DATE }} \ | |
| -t ghcr.io/${{ github.repository }}:artifacts \ | |
| ghcr.io/${{ github.repository }}:artifacts-amd64-${{ env.DATE }} \ | |
| ghcr.io/${{ github.repository }}:artifacts-arm64-${{ env.DATE }} |