33# Builds the nextstrain/base and nextstrain/base-builder images with useful
44# caching and pushes to a registry.
55#
6- # By default this tags images using "latest" and pushes to localhost:5000 with
7- # same-registry caching, but you can provide a custom tag with -t <tag> and
8- # specify different registries with -o <output_registry> and
9- # -c <cache_registry>.
6+ # By default this tags images using "latest" and pushes to localhost:5000, but
7+ # you can provide a custom tag with -t <tag> and specify a different
8+ # registry with -r <registry>.
109#
1110# Set CACHE_DATE in your environment to force layers after our custom cache
1211# point to be re-built. See the ARG CACHE_DATE line in the Dockerfile for more
@@ -16,18 +15,16 @@ set -euo pipefail
1615
1716# Set default values.
1817platform=linux/amd64
19- cache_registry=localhost:5000
20- output_registry=localhost:5000
18+ registry=localhost:5000
2119tag=latest
2220
2321# Read command-line arguments.
24- while getopts " p:c:o :t:" opt; do
22+ while getopts " p:r :t:" opt; do
2523 case " $opt " in
2624 p) platform=" $OPTARG " ;;
27- c) cache_registry=" $OPTARG " ;;
28- o) output_registry=" $OPTARG " ;;
25+ r) registry=" $OPTARG " ;;
2926 t) tag=" $OPTARG " ;;
30- * ) echo " Usage: $0 [-p <platform>] [-c <cache_registry>] [-o <output_registry >] [-t <tag>]" 1>&2 ; exit 1;;
27+ * ) echo " Usage: $0 [-p <platform>] [-r <registry >] [-t <tag>]" 1>&2 ; exit 1;;
3128 esac
3229done
3330
@@ -63,10 +60,10 @@ docker buildx build \
6360 --build-arg CACHE_DATE \
6461 --cache-from " $BUILDER_IMAGE :latest" \
6562 --cache-from " $BUILDER_IMAGE :$tag " \
66- --cache-from " $cache_registry /$BUILDER_IMAGE :latest" \
67- --cache-from " $cache_registry /$BUILDER_IMAGE :$tag " \
63+ --cache-from " $registry /$BUILDER_IMAGE :latest" \
64+ --cache-from " $registry /$BUILDER_IMAGE :$tag " \
6865 --cache-to type=inline \
69- --tag " $output_registry /$BUILDER_IMAGE :$tag " \
66+ --tag " $registry /$BUILDER_IMAGE :$tag " \
7067 --push \
7168 --provenance false \
7269 .
@@ -76,16 +73,17 @@ docker buildx build \
7673 --builder " $builder " \
7774 --platform " $platform " \
7875 --build-arg GIT_REVISION \
76+ --build-arg CACHE_DATE \
7977 --cache-from " $BUILDER_IMAGE :latest" \
8078 --cache-from " $BUILDER_IMAGE :$tag " \
8179 --cache-from " $FINAL_IMAGE :latest" \
8280 --cache-from " $FINAL_IMAGE :$tag " \
83- --cache-from " $cache_registry /$BUILDER_IMAGE :latest" \
84- --cache-from " $cache_registry /$BUILDER_IMAGE :$tag " \
85- --cache-from " $cache_registry /$FINAL_IMAGE :latest" \
86- --cache-from " $cache_registry /$FINAL_IMAGE :$tag " \
81+ --cache-from " $registry /$BUILDER_IMAGE :latest" \
82+ --cache-from " $registry /$BUILDER_IMAGE :$tag " \
83+ --cache-from " $registry /$FINAL_IMAGE :latest" \
84+ --cache-from " $registry /$FINAL_IMAGE :$tag " \
8785 --cache-to type=inline \
88- --tag " $output_registry /$FINAL_IMAGE :$tag " \
86+ --tag " $registry /$FINAL_IMAGE :$tag " \
8987 --push \
9088 --provenance false \
9189 .
0 commit comments