Skip to content

Commit 7190f72

Browse files
committed
Revert "build: Use different cache and output registries"
This reverts commit 917a048 and fixes the comment added by efbbfb9. We need to cache from ghcr.io because otherwise the build of nextstrain/base doesn't find the layers from the just-built nextstrain/base-builder pushed to ghcr.io. Instead, it seemingly uses layers from an older nextstrain/base-builder on docker.io. My understanding is that we were always pulling caches from docker.io (_and_ ghcr.io) because docker.io is the default registry when none is specified, and we use --cache-from lines without a registry specified. See <https://bedfordlab.slack.com/archives/C01LCTT7JNN/p1683932186614689>.
1 parent 50e442a commit 7190f72

File tree

2 files changed

+18
-21
lines changed

2 files changed

+18
-21
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14-
# Build multi-platform builder and final images with caching from Docker Hub;
15-
# push to GitHub Container Registry.
14+
# Build multi-platform builder and final images with caching from Docker Hub
15+
# and GitHub Container Registry; push to GitHub Container Registry.
1616
build:
1717
runs-on: ubuntu-latest
1818
steps:
@@ -42,7 +42,7 @@ jobs:
4242
username: nextstrain-bot
4343
password: ${{ secrets.GH_TOKEN_NEXTSTRAIN_BOT_MANAGE_PACKAGES }}
4444

45-
- run: ./devel/build -p linux/amd64,linux/arm64 -c docker.io -o ghcr.io -t $TAG
45+
- run: ./devel/build -p linux/amd64,linux/arm64 -r ghcr.io -t $TAG
4646

4747
outputs:
4848
tag: ${{ env.TAG }}

devel/build

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
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.
1817
platform=linux/amd64
19-
cache_registry=localhost:5000
20-
output_registry=localhost:5000
18+
registry=localhost:5000
2119
tag=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
3229
done
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
.
@@ -80,12 +77,12 @@ docker buildx build \
8077
--cache-from "$BUILDER_IMAGE:$tag" \
8178
--cache-from "$FINAL_IMAGE:latest" \
8279
--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" \
80+
--cache-from "$registry/$BUILDER_IMAGE:latest" \
81+
--cache-from "$registry/$BUILDER_IMAGE:$tag" \
82+
--cache-from "$registry/$FINAL_IMAGE:latest" \
83+
--cache-from "$registry/$FINAL_IMAGE:$tag" \
8784
--cache-to type=inline \
88-
--tag "$output_registry/$FINAL_IMAGE:$tag" \
85+
--tag "$registry/$FINAL_IMAGE:$tag" \
8986
--push \
9087
--provenance false \
9188
.

0 commit comments

Comments
 (0)