Improve disk cleanup with comprehensive script based on Apache Flink #73
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
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| name: Build and Test container images | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-data-processing: | |
| name: Build data processing container image | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: linux/amd64 | |
| runner: ubuntu-latest | |
| arch: amd64 | |
| - platform: linux/arm64 | |
| runner: ubuntu-24.04-arm | |
| arch: arm64 | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 90 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Free up disk space | |
| run: ./.github/scripts/free_disk_space.sh | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver-opts: | | |
| image=moby/buildkit:v0.12.5 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push development container image | |
| if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| cache-from: type=gha,scope=main-${{ matrix.arch }} | |
| cache-to: type=gha,mode=max,scope=main-${{ matrix.arch }} | |
| tags: | | |
| ghcr.io/${{ github.repository }}:latest-${{ matrix.arch }} | |
| - name: Build and push tagged container image | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| cache-from: type=gha,scope=tag-${{ matrix.arch }} | |
| cache-to: type=gha,mode=max,scope=tag-${{ matrix.arch }} | |
| tags: | | |
| ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ matrix.arch }} | |
| create-data-processing-manifest: | |
| name: Create data processing multi-arch manifest | |
| runs-on: ubuntu-latest | |
| needs: build-data-processing | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Verify single-arch images availability (branch) | |
| if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
| run: | | |
| REPO="${{ github.repository }}" | |
| for tag in latest-amd64 latest-arm64; do | |
| for i in {1..20}; do | |
| if docker buildx imagetools inspect ghcr.io/$REPO:$tag > /dev/null 2>&1; then | |
| echo "Found ghcr.io/$REPO:$tag"; | |
| break; | |
| fi | |
| echo "Waiting for ghcr.io/$REPO:$tag to be available ($i/20)..."; | |
| sleep 3; | |
| done | |
| done | |
| - name: Create and push development manifest | |
| if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
| run: | | |
| REPO="${{ github.repository }}" | |
| docker buildx imagetools create \ | |
| -t ghcr.io/$REPO:latest \ | |
| ghcr.io/$REPO:latest-amd64 \ | |
| ghcr.io/$REPO:latest-arm64 | |
| - name: Verify single-arch images availability (tag) | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| REPO="${{ github.repository }}" | |
| for arch in amd64 arm64; do | |
| for i in {1..20}; do | |
| if docker buildx imagetools inspect ghcr.io/$REPO:${{ github.ref_name }}-$arch > /dev/null 2>&1; then | |
| echo "Found ghcr.io/$REPO:${{ github.ref_name }}-$arch"; | |
| break; | |
| fi | |
| echo "Waiting for ghcr.io/$REPO:${{ github.ref_name }}-$arch to be available ($i/20)..."; | |
| sleep 3; | |
| done | |
| done | |
| - name: Create and push tagged manifest | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| REPO="${{ github.repository }}" | |
| docker buildx imagetools create \ | |
| -t ghcr.io/$REPO:${{ github.ref_name }} \ | |
| ghcr.io/$REPO:${{ github.ref_name }}-amd64 \ | |
| ghcr.io/$REPO:${{ github.ref_name }}-arm64 | |