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
12 changes: 12 additions & 0 deletions .github/mirror.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Images CI pulls, copied from Docker Hub to ghcr.io/docspring/mirror/<name> by .github/workflows/mirror.yml, so a
# Docker Hub outage can't stop CI (4 Dec 2026: 502s from auth.docker.io failed a PR's journeys and images jobs).
# crane copy keeps the digest, so CI pins ghcr.io/docspring/mirror/<name>@<digest> to the same bytes as the source.
# To add or bump one: change its line here, merge, and once the workflow has run on main, use the new digest in CI.
# <name:tag> <source>@<digest>
postgres:17 docker.io/library/postgres@sha256:97fb53376be3e4fb1a8a61421daa69dcc3bf2fa39bda3259f5245f9a455af1a9
rustfs:1.0.6 docker.io/rustfs/rustfs@sha256:ee717072290bec9b11abfc0365f8310b00df1cd9b3639943edae47bdef05044a
rust:1.99.1-trixie docker.io/library/rust@sha256:8a4e90c7946b74626488b1446f712c0fe0ed1a596cbd3d871684bc9c5433ae07
node:24-trixie-slim docker.io/library/node@sha256:83079001d4ca6bf276035aa1c7b819b9542fc87a858a4fdc52ccc014bbf92143
debian:trixie-slim docker.io/library/debian@sha256:8aa5a7bf5a1955bddbe7d74fcdd0b91ab30e74362a8b73af672b0481b35b44a0
aws-cli:2.17.0 docker.io/amazon/aws-cli@sha256:643507c10ada7964ca6157b3d799f030b90577643da9955d319a77399ed80d73
buildkit:buildx-stable-1 docker.io/moby/buildkit@sha256:baf6138eb8c37644800c7c913fba051e840ebb9ba13eaf92d92ef9a1712d0b4c
61 changes: 61 additions & 0 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copies the images in .github/mirror.txt from Docker Hub to ghcr.io/docspring/mirror/<name>, keeping their digests,
# so CI pulls them from GitHub's own registry. Runs on main when the list changes, weekly to repair a deleted copy, and
# by hand. Only main runs it; CI pins the copies by digest, so a tag overwritten from a branch changes nothing CI runs.
name: Mirror base images

on:
push:
branches: [main]
paths: [.github/mirror.txt, .github/workflows/mirror.yml]
schedule:
- cron: "17 3 * * 1"
workflow_dispatch:

permissions:
contents: read
packages: write

concurrency:
group: mirror-base-images
cancel-in-progress: false

jobs:
mirror:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install crane (go-containerregistry), checksum verified
env:
GH_TOKEN: ${{ github.token }}
VERSION: v0.22.1
SHA256: 0ab7a1d6932a213aed964ce97666c3077fe691c8606413674a8b3e0b9ec4cda0
run: |
cd "$RUNNER_TEMP"
gh release download "$VERSION" -R google/go-containerregistry \
-p go-containerregistry_Linux_x86_64.tar.gz
# Pinned here, not read from the release's own checksums.txt, so a replaced release can't pass.
echo "$SHA256 go-containerregistry_Linux_x86_64.tar.gz" | sha256sum -c -
tar -xzf go-containerregistry_Linux_x86_64.tar.gz crane
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
- run: printf '%s' "$TOKEN" | crane auth login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
env:
TOKEN: ${{ github.token }}
- name: Copy each image, retrying Docker Hub's hiccups
run: |
status=0
while read -r name source; do
case "$name" in ''|\#*) continue ;; esac
want=${source##*@}
dest=ghcr.io/docspring/mirror/$name
if [ "$(crane digest "$dest" 2>/dev/null)" = "$want" ]; then echo "up to date: $dest"; continue; fi
for attempt in 1 2 3 4 5; do
crane copy "$source" "$dest" && break
[ "$attempt" = 5 ] || { echo "attempt $attempt failed; retrying in $((attempt * 20)) s"; sleep $((attempt * 20)); }
done
got=$(crane digest "$dest" 2>/dev/null || true)
if [ "$got" = "$want" ]; then echo "copied: $dest@$want"; else echo "::error::$dest is ${got:-missing}, want $want"; status=1; fi
done < .github/mirror.txt
exit $status
Loading