diff --git a/devel/build b/devel/build index 72e7d121..17a59b46 100755 --- a/devel/build +++ b/devel/build @@ -53,20 +53,36 @@ if ! docker buildx inspect "$builder" &>/dev/null; then docker buildx create --name "$builder" --driver docker-container --driver-opt network=host fi -BUILDER_IMAGE=nextstrain/base-builder +BUILD_PLATFORM_BUILDER_IMAGE=nextstrain/base-builder-build-platform +TARGET_PLATFORM_BUILDER_IMAGE=nextstrain/base-builder-target-platform FINAL_IMAGE=nextstrain/base docker buildx build \ - --target builder \ + --target builder-build-platform \ --builder "$builder" \ --platform "$platform" \ --build-arg CACHE_DATE \ - --cache-from "$BUILDER_IMAGE:latest" \ - --cache-from "$BUILDER_IMAGE:$tag" \ - --cache-from "$registry/$BUILDER_IMAGE:latest" \ - --cache-from "$registry/$BUILDER_IMAGE:$tag" \ + --cache-from "$BUILD_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$BUILD_PLATFORM_BUILDER_IMAGE:$tag" \ + --cache-from "$registry/$BUILD_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$registry/$BUILD_PLATFORM_BUILDER_IMAGE:$tag" \ --cache-to type=inline \ - --tag "$registry/$BUILDER_IMAGE:$tag" \ + --tag "$registry/$BUILD_PLATFORM_BUILDER_IMAGE:$tag" \ + --push \ + --provenance false \ + . + +docker buildx build \ + --target builder-target-platform \ + --builder "$builder" \ + --platform "$platform" \ + --build-arg CACHE_DATE \ + --cache-from "$TARGET_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$TARGET_PLATFORM_BUILDER_IMAGE:$tag" \ + --cache-from "$registry/$TARGET_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$registry/$TARGET_PLATFORM_BUILDER_IMAGE:$tag" \ + --cache-to type=inline \ + --tag "$registry/$TARGET_PLATFORM_BUILDER_IMAGE:$tag" \ --push \ --provenance false \ . @@ -77,12 +93,16 @@ docker buildx build \ --platform "$platform" \ --build-arg GIT_REVISION \ --build-arg CACHE_DATE \ - --cache-from "$BUILDER_IMAGE:latest" \ - --cache-from "$BUILDER_IMAGE:$tag" \ + --cache-from "$BUILD_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$BUILD_PLATFORM_BUILDER_IMAGE:$tag" \ + --cache-from "$TARGET_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$TARGET_PLATFORM_BUILDER_IMAGE:$tag" \ --cache-from "$FINAL_IMAGE:latest" \ --cache-from "$FINAL_IMAGE:$tag" \ - --cache-from "$registry/$BUILDER_IMAGE:latest" \ - --cache-from "$registry/$BUILDER_IMAGE:$tag" \ + --cache-from "$registry/$BUILD_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$registry/$BUILD_PLATFORM_BUILDER_IMAGE:$tag" \ + --cache-from "$registry/$TARGET_PLATFORM_BUILDER_IMAGE:latest" \ + --cache-from "$registry/$TARGET_PLATFORM_BUILDER_IMAGE:$tag" \ --cache-from "$registry/$FINAL_IMAGE:latest" \ --cache-from "$registry/$FINAL_IMAGE:$tag" \ --cache-to type=inline \ diff --git a/devel/copy-images b/devel/copy-images index a9c372e5..b7a502ca 100755 --- a/devel/copy-images +++ b/devel/copy-images @@ -33,7 +33,8 @@ if [[ "$tag" = "" ]]; then exit 1 fi -BUILDER_IMAGE=nextstrain/base-builder +BUILD_PLATFORM_BUILDER_IMAGE=nextstrain/base-builder-build-platform +TARGET_PLATFORM_BUILDER_IMAGE=nextstrain/base-builder-target-platform FINAL_IMAGE=nextstrain/base @@ -77,26 +78,36 @@ copy-image() { # Copy $tag between registries. +echo "Copying $registry_in/$BUILD_PLATFORM_BUILDER_IMAGE:$tag to $registry_out/$BUILD_PLATFORM_BUILDER_IMAGE:$tag." +copy-image \ + "$registry_in/$BUILD_PLATFORM_BUILDER_IMAGE:$tag" \ + "$registry_out/$BUILD_PLATFORM_BUILDER_IMAGE:$tag" + +echo "Copying $registry_in/$TARGET_PLATFORM_BUILDER_IMAGE:$tag to $registry_out/$TARGET_PLATFORM_BUILDER_IMAGE:$tag." +copy-image \ + "$registry_in/$TARGET_PLATFORM_BUILDER_IMAGE:$tag" \ + "$registry_out/$TARGET_PLATFORM_BUILDER_IMAGE:$tag" + echo "Copying $registry_in/$FINAL_IMAGE:$tag to $registry_out/$FINAL_IMAGE:$tag." copy-image \ "$registry_in/$FINAL_IMAGE:$tag" \ "$registry_out/$FINAL_IMAGE:$tag" -echo "Copying $registry_in/$BUILDER_IMAGE:$tag to $registry_out/$BUILDER_IMAGE:$tag." -copy-image \ - "$registry_in/$BUILDER_IMAGE:$tag" \ - "$registry_out/$BUILDER_IMAGE:$tag" - if [[ "$push_latest" = true ]]; then # Copy $tag to latest. + echo "Copying $registry_in/$BUILD_PLATFORM_BUILDER_IMAGE:$tag to $registry_out/$BUILD_PLATFORM_BUILDER_IMAGE:latest." + copy-image \ + "$registry_in/$BUILD_PLATFORM_BUILDER_IMAGE:$tag" \ + "$registry_out/$BUILD_PLATFORM_BUILDER_IMAGE:latest" + + echo "Copying $registry_in/$TARGET_PLATFORM_BUILDER_IMAGE:$tag to $registry_out/$TARGET_PLATFORM_BUILDER_IMAGE:latest." + copy-image \ + "$registry_in/$TARGET_PLATFORM_BUILDER_IMAGE:$tag" \ + "$registry_out/$TARGET_PLATFORM_BUILDER_IMAGE:latest" + echo "Copying $registry_in/$FINAL_IMAGE:$tag to $registry_out/$FINAL_IMAGE:latest." copy-image \ "$registry_in/$FINAL_IMAGE:$tag" \ "$registry_out/$FINAL_IMAGE:latest" - - echo "Copying $registry_in/$BUILDER_IMAGE:$tag to $registry_out/$BUILDER_IMAGE:latest." - copy-image \ - "$registry_in/$BUILDER_IMAGE:$tag" \ - "$registry_out/$BUILDER_IMAGE:latest" fi diff --git a/devel/delete-from-ghcr.js b/devel/delete-from-ghcr.js index 479fe172..1b1dbe6d 100644 --- a/devel/delete-from-ghcr.js +++ b/devel/delete-from-ghcr.js @@ -8,7 +8,11 @@ module.exports = async ({octokit, tag}) => { org = 'nextstrain'; - packages = ['base', 'base-builder']; + packages = [ + 'base', + 'base-builder-build-platform', + 'base-builder-target-platform', + ]; // Try all packages before terminating with any errors. let errorEncountered = false; diff --git a/devel/pull-from-registry b/devel/pull-from-registry index 4a6a0fe0..e371723e 100755 --- a/devel/pull-from-registry +++ b/devel/pull-from-registry @@ -17,8 +17,10 @@ while getopts "r:t:" opt; do esac done -BUILDER_IMAGE=nextstrain/base-builder +BUILD_PLATFORM_BUILDER_IMAGE=nextstrain/base-builder-build-platform +TARGET_PLATFORM_BUILDER_IMAGE=nextstrain/base-builder-target-platform FINAL_IMAGE=nextstrain/base -docker pull "$registry/$BUILDER_IMAGE:$tag" +docker pull "$registry/$BUILD_PLATFORM_BUILDER_IMAGE:$tag" +docker pull "$registry/$TARGET_PLATFORM_BUILDER_IMAGE:$tag" docker pull "$registry/$FINAL_IMAGE:$tag"