Skip to content

Commit 49d014b

Browse files
Create new buildx builder to allow remote registry caching
1 parent 0ca21ba commit 49d014b

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ jobs:
3232
if: ${{ inputs.environment == 'staging' }}
3333
run: docker login -u '${{ secrets.DOCKER_USERNAME_STAGING }}' -p '${{ secrets.DOCKER_PASSWORD_STAGING }}' registry.anvil.rcac.purdue.edu
3434

35+
# This step is necessary because our script uses the destination OCI registry as a layer cache, which isn't supported by Docker out of the box.
36+
# See https://docs.docker.com/build/cache/backends/registry/ and https://docs.docker.com/build/builders/drivers/ for more info.
37+
- name: Set up buildx builder
38+
run: |
39+
docker buildx create --use
40+
docker buildx inspect --bootstrap
41+
3542
- name: Release
3643
run: ./.github/workflows/scripts/release-${{ inputs.environment }}.sh "${{ inputs.version }}"
3744
env:

.github/workflows/scripts/release.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ build_and_push() {
5151

5252
IIDFILE=$(mktemp)
5353

54-
docker build \
54+
docker buildx build \
5555
--push \
5656
-f "$DOCKERFILE" \
5757
--iidfile "$IIDFILE" \
5858
-t "$IMAGE_TAG" \
5959
--cache-from="type=registry,ref=$CACHE_TAG" \
60-
--cache-to="type=registry,ref=$CACHE_TAG" \
60+
--cache-to="type=registry,ref=$CACHE_TAG,mode=max" \
6161
"$BUILD_CONTEXT"
6262

6363
IMAGE_ID=$(cat "$IIDFILE") # looks like "sha256:32975dcafd44d8c6f921d2276e2a39f42f268e8c9584d6c4d4c88f5a073b7b1d"

0 commit comments

Comments
 (0)