@@ -342,6 +342,8 @@ jobs:
342
342
# documentation:
343
343
# https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api
344
344
cache-to : type=gha,mode=max
345
+ # For a list of pre-defined annotation keys and value types see:
346
+ # https://github.com/opencontainers/image-spec/blob/master/annotations.md
345
347
labels : ${{ needs.prepare.outputs.labels }}
346
348
outputs : type=docker,dest=dist/image.tar
347
349
# Uncomment the following option if you are building an image for use
@@ -350,8 +352,6 @@ jobs:
350
352
# information: https://github.com/docker/buildx/issues/1533
351
353
# provenance: false
352
354
tags : ${{ needs.repo-metadata.outputs.image-name }}:latest # not to be pushed
353
- # For a list of pre-defined annotation keys and value types see:
354
- # https://github.com/opencontainers/image-spec/blob/master/annotations.md
355
355
- name : Compress image
356
356
run : gzip dist/image.tar
357
357
- name : Upload artifacts
@@ -500,7 +500,17 @@ jobs:
500
500
uses : docker/setup-qemu-action@v3
501
501
- name : Set up Docker Buildx
502
502
uses : docker/setup-buildx-action@v3
503
- - name : Build and push platform images to registries
503
+ # We only build to ensure that the image layers are cached to push later. This is
504
+ # because if the build takes over 10 minutes the token acquired to push to the
505
+ # GitHub Container Registry will have expired. This results in errors like:
506
+ #
507
+ # <AuthenticationErrorDetail>Signature not valid in the specified time frame:
508
+ # Start [Tue, 08 Jul 2025 06:05:02 GMT] - Expiry [Tue, 08 Jul 2025 06:15:07 GMT]
509
+ # - Current [Tue, 08 Jul 2025 06:16:10 GMT]</AuthenticationErrorDetail>
510
+ #
511
+ # Please see https://github.com/docker/build-push-action/issues/1371 for more
512
+ # information.
513
+ - name : Build platform images
504
514
id : docker_build
505
515
uses : docker/build-push-action@v6
506
516
with :
@@ -511,17 +521,40 @@ jobs:
511
521
# documentation:
512
522
# https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api
513
523
cache-to : type=gha,mode=max
524
+ # For a list of pre-defined annotation keys and value types see:
525
+ # https://github.com/opencontainers/image-spec/blob/master/annotations.md
514
526
labels : ${{ needs.prepare.outputs.labels }}
515
527
platforms : ${{ join(fromJSON(needs.repo-metadata.outputs.image-platforms)) }}
516
528
# Uncomment the following option if you are building an image for use
517
529
# on Google Cloud Run or AWS Lambda. The current default image output
518
530
# is unable to run on either. Please see the following issue for more
519
531
# information: https://github.com/docker/buildx/issues/1533
520
532
# provenance: false
521
- push : true
522
533
tags : ${{ needs.prepare.outputs.tags }}
534
+ # Now that the image layers should be available from the cache we can push to the
535
+ # registries.
536
+ - name : Push platform images to registries
537
+ id : docker_push
538
+ uses : docker/build-push-action@v6
539
+ with :
540
+ cache-from : type=gha
541
+ # We use the max mode to cache all layers which includes ones from
542
+ # intermediate steps. This will provide us the potential for more cache hits
543
+ # and thus better build times. It is also the suggested setting per the
544
+ # documentation:
545
+ # https://docs.docker.com/build/ci/github-actions/cache/#cache-backend-api
546
+ cache-to : type=gha,mode=max
523
547
# For a list of pre-defined annotation keys and value types see:
524
548
# https://github.com/opencontainers/image-spec/blob/master/annotations.md
549
+ labels : ${{ needs.prepare.outputs.labels }}
550
+ platforms : ${{ join(fromJSON(needs.repo-metadata.outputs.image-platforms)) }}
551
+ # Uncomment the following option if you are building an image for use
552
+ # on Google Cloud Run or AWS Lambda. The current default image output
553
+ # is unable to run on either. Please see the following issue for more
554
+ # information: https://github.com/docker/buildx/issues/1533
555
+ # provenance: false
556
+ push : true
557
+ tags : ${{ needs.prepare.outputs.tags }}
525
558
- name : Setup tmate debug session
526
559
uses : mxschmitt/action-tmate@v3
527
560
if : env.RUN_TMATE
0 commit comments