ci-build.yml used the legacy actions/cache + /tmp/.buildx-cache local cache with a manual rotate step. Switch it to buildx type=gha cache (separate scopes for the main and example images), dropping the actions/cache and rotate-cache steps. docker.yml built each image twice per platform — one build-push-action call per registry. Build once and push the same content-addressed image to both ghcr.io and DockerHub via multiple outputs; the single build digest is identical for both registries, so digest export is simplified accordingly. The multi-arch manifest merge is unchanged.
64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
name: build
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/ci-build.yml"
|
|
- "backend/**"
|
|
- "frontend/apps/**"
|
|
- ".dockerignore"
|
|
- "docker-init.sh"
|
|
- "Dockerfile"
|
|
- "!**.md"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-images:
|
|
name: Validate Docker build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
- name: free disk space
|
|
run: |
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf /usr/local/share/boost
|
|
docker system prune -af
|
|
|
|
- name: build docker image without pushing
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
load: true
|
|
cache-from: type=gha,scope=main
|
|
cache-to: type=gha,scope=main,mode=max,ignore-error=true
|
|
build-args: |
|
|
SKIP_BACKEND_TEST=true
|
|
SKIP_FRONTEND_TEST=true
|
|
|
|
- name: build example docker image without pushing
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: backend/_example/memory_store/Dockerfile
|
|
platforms: linux/amd64
|
|
load: true
|
|
cache-from: type=gha,scope=example
|
|
cache-to: type=gha,scope=example,mode=max,ignore-error=true
|
|
build-args: |
|
|
SKIP_BACKEND_TEST=true
|
|
SKIP_FRONTEND_TEST=true
|