Skip to content

Commit 4a8cf85

Browse files
authored
Merge pull request #155 from nextstrain/cache-from-ghcr.io
Revert "build: Use different cache and output registries"
2 parents 50e442a + b762669 commit 4a8cf85

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-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: 16 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
.
@@ -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

Comments
 (0)