A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
ci: publish to GHCR first and mirror Docker Hub best-effort
Amruth Pillai96aad51b0446
diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.ymlindex 98b32b32b..d4b5e52e7 100644--- a/.github/workflows/docker-build.yml+++ b/.github/workflows/docker-build.yml@@ -114,30 +114,14 @@ jobs:set -euo pipefaildockerhub=false- ghcr_image="${GHCR_IMAGE,,}"- docker_image="${DOCKER_IMAGE,,}"- images="$ghcr_image"- if [[ -n "$DOCKER_USERNAME" && -n "$DOCKER_PASSWORD" ]]; then- dockerhub=true- images="${images}"$'\n'"$docker_image"- fi+ if [[ -n "$DOCKER_USERNAME" && -n "$DOCKER_PASSWORD" ]]; then dockerhub=true; fi{- echo "ghcr_image=$ghcr_image"- echo "docker_image=$docker_image"- echo "images<<EOF"- echo "$images"- echo "EOF"+ echo "ghcr_image=${GHCR_IMAGE,,}"+ echo "docker_image=${DOCKER_IMAGE,,}"echo "dockerhub=$dockerhub"} >> "$GITHUB_OUTPUT"- - name: Login to Docker Hub- if: ${{ steps.registries.outputs.dockerhub == 'true' }}- uses: docker/login-action@v4- with:- username: ${{ secrets.DOCKER_USERNAME }}- password: ${{ secrets.DOCKER_PASSWORD }}-- name: Login to GitHub Container Registryuses: docker/login-action@v4with:@@ -149,7 +133,7 @@ jobs:id: metauses: docker/metadata-action@v6with:- images: ${{ steps.registries.outputs.images }}+ images: ${{ steps.registries.outputs.ghcr_image }}tags: |type=raw,value=sha-${{ steps.source.outputs.sha }}-${{ matrix.arch }}@@ -263,13 +247,6 @@ jobs:- *registries- - name: Login to Docker Hub- if: ${{ steps.registries.outputs.dockerhub == 'true' }}- uses: docker/login-action@v4- with:- username: ${{ secrets.DOCKER_USERNAME }}- password: ${{ secrets.DOCKER_PASSWORD }}-- name: Login to GitHub Container Registryuses: docker/login-action@v4with:@@ -291,7 +268,7 @@ jobs:id: metauses: docker/metadata-action@v6with:- images: ${{ steps.registries.outputs.images }}+ images: ${{ steps.registries.outputs.ghcr_image }}flavor: latest=falsetags: |type=raw,value=sha-${{ steps.version.outputs.sha }},enable=${{ needs.mode.outputs.release != 'true' }}@@ -342,13 +319,11 @@ jobs:# Get the digest of the multi-arch manifestGHCR_DIGEST=$(docker buildx imagetools inspect "${{ steps.registries.outputs.ghcr_image }}:${FINAL_TAG}" --format '{{json .Manifest.Digest}}' | tr -d '"')- echo "final_tag=$FINAL_TAG" >> "$GITHUB_OUTPUT"- echo "ghcr_digest=$GHCR_DIGEST" >> "$GITHUB_OUTPUT"-- if [[ "${{ steps.registries.outputs.dockerhub }}" == "true" ]]; then- DOCKER_DIGEST=$(docker buildx imagetools inspect "${{ steps.registries.outputs.docker_image }}:${FINAL_TAG}" --format '{{json .Manifest.Digest}}' | tr -d '"')- echo "docker_digest=$DOCKER_DIGEST" >> "$GITHUB_OUTPUT"- fi+ {+ echo "final_tag=$FINAL_TAG"+ echo "ghcr_digest=$GHCR_DIGEST"+ echo "tags=${tags[*]}"+ } >> "$GITHUB_OUTPUT"- name: Promote existing SHA imageid: promotion@@ -363,7 +338,6 @@ jobs:env:BUILD_TAG: ${{ steps.manifest.outputs.final_tag }}GHCR_DIGEST: ${{ steps.manifest.outputs.ghcr_digest || steps.promotion.outputs.ghcr_digest }}- DOCKER_DIGEST: ${{ steps.manifest.outputs.docker_digest || steps.promotion.outputs.docker_digest }}VERSION: ${{ steps.version.outputs.version }}PRERELEASE: ${{ steps.version.outputs.prerelease }}run: |@@ -374,28 +348,16 @@ jobs:{echo "final_tag=$final_tag"echo "ghcr_digest=$GHCR_DIGEST"- echo "docker_digest=$DOCKER_DIGEST"} >> "$GITHUB_OUTPUT"- name: Install Cosignuses: sigstore/cosign-installer@v3- - name: Sign images with Cosign- run: |- # Sign GHCR image- cosign sign --yes ${{ steps.registries.outputs.ghcr_image }}@${{ steps.published.outputs.ghcr_digest }}-- if [[ "${{ steps.registries.outputs.dockerhub }}" == "true" ]]; then- # Sign Docker Hub image- cosign sign --yes ${{ steps.registries.outputs.docker_image }}@${{ steps.published.outputs.docker_digest }}- fi+ - name: Sign image with Cosign+ run: cosign sign --yes ${{ steps.registries.outputs.ghcr_image }}@${{ steps.published.outputs.ghcr_digest }}- name: Inspect image- run: |- docker buildx imagetools inspect ${{ steps.registries.outputs.ghcr_image }}:${{ steps.published.outputs.final_tag }}- if [[ "${{ steps.registries.outputs.dockerhub }}" == "true" ]]; then- docker buildx imagetools inspect ${{ steps.registries.outputs.docker_image }}:${{ steps.published.outputs.final_tag }}- fi+ run: docker buildx imagetools inspect ${{ steps.registries.outputs.ghcr_image }}:${{ steps.published.outputs.final_tag }}- name: Verify anonymous pulls on both architecturesrun: |@@ -403,18 +365,42 @@ jobs:registry_config=$(mktemp -d)trap 'rm -rf "$registry_config"' EXIT# Prevent Docker from discovering a system credential helper.- printf '%s\n' '{"auths":{"ghcr.io":{},"https://index.docker.io/v1/":{}}}' > "$registry_config/config.json"- images=("${{ steps.registries.outputs.ghcr_image }}")- if [[ "${{ steps.registries.outputs.dockerhub }}" == "true" ]]; then- images+=("${{ steps.registries.outputs.docker_image }}")- fi- for image in "${images[@]}"; do- for platform in linux/amd64 linux/arm64; do- docker --config "$registry_config" pull --quiet --platform "$platform" \- "$image:${{ steps.published.outputs.final_tag }}"- done+ printf '%s\n' '{"auths":{"ghcr.io":{}}}' > "$registry_config/config.json"+ for platform in linux/amd64 linux/arm64; do+ docker --config "$registry_config" pull --quiet --platform "$platform" \+ "${{ steps.registries.outputs.ghcr_image }}:${{ steps.published.outputs.final_tag }}"done+ # Docker Hub is a best-effort mirror of the published GHCR index: its failures show as failed+ # steps but never fail the job. A single-source copy keeps the GHCR digest and attestations.+ - name: Login to Docker Hub+ id: dockerhub-login+ if: ${{ steps.registries.outputs.dockerhub == 'true' }}+ continue-on-error: true+ uses: docker/login-action@v4+ with:+ username: ${{ secrets.DOCKER_USERNAME }}+ password: ${{ secrets.DOCKER_PASSWORD }}++ - name: Mirror to Docker Hub+ if: ${{ steps.dockerhub-login.outcome == 'success' }}+ continue-on-error: true+ timeout-minutes: 15+ env:+ GHCR_IMAGE: ${{ steps.registries.outputs.ghcr_image }}+ DOCKER_IMAGE: ${{ steps.registries.outputs.docker_image }}+ DIGEST: ${{ steps.published.outputs.ghcr_digest }}+ TAGS: ${{ steps.manifest.outputs.tags }}+ run: |+ set -euo pipefail+ # Builds pass the tags they actually pushed; promotions move every metadata tag.+ if [[ -z "$TAGS" ]]; then TAGS=$(jq -r '.tags | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON"); fi+ args=()+ for tag in $TAGS; do args+=(--tag "$DOCKER_IMAGE:${tag#"$GHCR_IMAGE:"}"); done+ docker buildx imagetools create "${args[@]}" "$GHCR_IMAGE@$DIGEST"+ cosign sign --yes "$DOCKER_IMAGE@$DIGEST"+ docker buildx imagetools inspect "$DOCKER_IMAGE:${{ steps.published.outputs.final_tag }}"+- name: Redeploy Stackif: ${{ needs.mode.outputs.release == 'true' && steps.version.outputs.prerelease != 'true' && env.DEPLOY == 'true' }}uses: appleboy/ssh-action@v1diff --git a/docs/agents/container-publishing.md b/docs/agents/container-publishing.mdindex c7dc8bcc6..c4c13ead5 100644--- a/docs/agents/container-publishing.md+++ b/docs/agents/container-publishing.md@@ -35,11 +35,11 @@ the current main HEAD updates the moving `nightly` alias. Architecture-specificoutputs use `sha-<full-commit>-amd64` and `sha-<full-commit>-arm64`.Release tags must be `vMAJOR.MINOR.PATCH`, optionally with a prerelease suffix, and match-`package.json` at the tagged commit. Promotion resolves that commit's-`sha-<full-commit>` image independently in each enabled registry, validates both architectures,-and copies the complete image index within that registry. It adds no annotations and checks-that each resulting alias has the source digest. Embedded SBOM/provenance manifests and-existing digest-addressed signatures stay intact; the workflow also signs the promoted digest.+`package.json` at the tagged commit. Promotion resolves that commit's GHCR+`sha-<full-commit>` image, validates both architectures, and copies the complete image index+within GHCR. It adds no annotations and checks that each resulting alias has the source digest.+Embedded SBOM/provenance manifests and existing digest-addressed signatures stay intact; the+workflow also signs the promoted digest.If the main build is still running, promotion waits up to 35 minutes for the source images.Missing images or incomplete indexes fail before aliases move; promotion never falls back to@@ -75,10 +75,14 @@ gh workflow run docker-build.yml --repo reactive-resume/reactive-resume --ref ma```Published images retain SBOMs, maximum provenance, and Cosign signatures. GHCR always uses-the destination repository's `GITHUB_TOKEN` with `packages: write`. Docker Hub publishing-is enabled only when both `DOCKER_USERNAME` and `DOCKER_PASSWORD` secrets are present;-otherwise login, publishing, signing, and verification target GHCR only. Image references-are normalized to lowercase. New GHCR packages need public visibility, repository linkage,+the destination repository's `GITHUB_TOKEN` with `packages: write`. GHCR is the primary+registry: builds, indexes, promotion, signing, anonymous-pull verification, and production+deployment depend on it alone. Docker Hub is a best-effort mirror, enabled only when both+`DOCKER_USERNAME` and `DOCKER_PASSWORD` secrets are present. After GHCR is published and+verified, the workflow copies the GHCR index to Docker Hub under the same tags (same digest)+and signs it there; Docker Hub login or mirror failures show as failed steps but never fail+the run. Rerun the workflow to retry a missed mirror. Image references are normalized to+lowercase. New GHCR packages need public visibility, repository linkage,and Actions access before consumers can pull anonymously.## Verification and historical imagesdiff --git a/tooling/docker/promote.sh b/tooling/docker/promote.shindex 063a06fed..8cdd822b7 100644--- a/tooling/docker/promote.sh+++ b/tooling/docker/promote.sh@@ -1,7 +1,7 @@#!/usr/bin/env bashset -euo pipefail-# Retag complete indexes within each registry. No rebuilds or annotation changes:+# Retag complete GHCR indexes. No rebuilds or annotation changes:# attestations stay embedded, and digest-addressed Cosign signatures stay valid.source_tag="sha-${COMMIT_SHA:?}"images=()@@ -52,9 +52,5 @@ for index in "${!images[@]}"; doexit 1fidone- if [[ "$image" == "$GHCR_IMAGE" ]]; then- echo "ghcr_digest=$digest" >> "$GITHUB_OUTPUT"- else- echo "docker_digest=$digest" >> "$GITHUB_OUTPUT"- fi+ echo "ghcr_digest=$digest" >> "$GITHUB_OUTPUT"done