Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ jobs:
- name: Build the image
env:
REGISTRY_MIRROR: ${{ vars.REGISTRY_MIRROR }}
run: ./build.sh 26 "linux/$ARCH"
run: |
if [ -n "${REGISTRY_MIRROR:-}" ]; then
export BUILD_CACHE_REF="${REGISTRY_MIRROR%%/*}/aws-lambda-nodejs-runtime-buildcache"
fi
./build.sh 26 "linux/$ARCH"

- name: Smoke-test the image
run: node test/run.mjs "$IMAGE" "linux/$ARCH"
Expand Down
9 changes: 8 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ fi
build() {
stage=$1 tag=$2 epoch=$3
shift 3
SOURCE_DATE_EPOCH=$epoch docker buildx build ${BUILDX_FLAGS:-} \
# Persist/restore a BuildKit layer cache per stage+arch when BUILD_CACHE_REF is set. Keying by
# stage keeps the expensive lang/gcc/node cache from being overwritten by a later, cheaper stage.
cache_flags=
if [ -n "${BUILD_CACHE_REF:-}" ]; then
_cache_ref="${BUILD_CACHE_REF}:${arch}-${stage}"
cache_flags="--cache-from type=registry,ref=${_cache_ref} --cache-to type=registry,ref=${_cache_ref},mode=max,image-manifest=true,oci-mediatypes=true"
fi
SOURCE_DATE_EPOCH=$epoch docker buildx build ${BUILDX_FLAGS:-} $cache_flags \
--platform "$platform" \
--target "$stage" \
--build-arg BASE_MINIMAL="$AL2023_MINIMAL" \
Expand Down