Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🪞 ci: Mirror Published Images to a Legacy GHCR Namespace (#16214)

Danny Avila07e155338dcc
diff --git a/.github/workflows/dev-branch-images.yml b/.github/workflows/dev-branch-images.yml
index 08d38824c7..2c71cfd7d1 100644
--- a/.github/workflows/dev-branch-images.yml
+++ b/.github/workflows/dev-branch-images.yml
@@ -46,3 +46,4 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ LEGACY_GHCR_TOKEN: ${{ secrets.LEGACY_GHCR_TOKEN }}
diff --git a/.github/workflows/dev-images.yml b/.github/workflows/dev-images.yml
index eda56c689b..a8b819ae72 100644
--- a/.github/workflows/dev-images.yml
+++ b/.github/workflows/dev-images.yml
@@ -42,3 +42,4 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ LEGACY_GHCR_TOKEN: ${{ secrets.LEGACY_GHCR_TOKEN }}
diff --git a/.github/workflows/dev-staging-images.yml b/.github/workflows/dev-staging-images.yml
index 49c30a3b6f..18e13cc920 100644
--- a/.github/workflows/dev-staging-images.yml
+++ b/.github/workflows/dev-staging-images.yml
@@ -21,3 +21,4 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ LEGACY_GHCR_TOKEN: ${{ secrets.LEGACY_GHCR_TOKEN }}
diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml
index 69ceddb644..2ec0776a1f 100644
--- a/.github/workflows/docker-publish.yml
+++ b/.github/workflows/docker-publish.yml
@@ -45,6 +45,11 @@ on:
required: true
DOCKERHUB_TOKEN:
required: true
+ LEGACY_GHCR_TOKEN:
+ description: >-
+ Token that can write to the LEGACY_GHCR_OWNER namespace. Without it the
+ mirror step is skipped.
+ required: false
permissions:
contents: read
@@ -242,3 +247,43 @@ jobs:
set -euo pipefail
first_tag=$(grep -m1 -v '^[[:space:]]*$' <<< "$TAG_SUFFIXES")
docker buildx imagetools inspect "${GHCR_IMAGE}:${first_tag}"
+
+ # After the move to another owner, deployments still pull the old GHCR
+ # namespace. Copying each published tag there keeps them updating until the
+ # deprecation window closes. Copies are cross-repo blob mounts within GHCR,
+ # so no image data is rebuilt or re-uploaded.
+ #
+ # Set the LEGACY_GHCR_OWNER variable and the LEGACY_GHCR_TOKEN secret (a token
+ # with write:packages for that owner) to turn this on. It stays off when either
+ # is unset, and while the owner still matches the one publishing the images.
+ - name: Mirror tags to the legacy namespace
+ if: ${{ vars.LEGACY_GHCR_OWNER != '' }}
+ continue-on-error: true
+ env:
+ LEGACY_OWNER: ${{ vars.LEGACY_GHCR_OWNER }}
+ LEGACY_TOKEN: ${{ secrets.LEGACY_GHCR_TOKEN }}
+ IMAGE_NAME: ${{ matrix.image.image_name }}
+ TAG_SUFFIXES: ${{ inputs.tag_suffixes }}
+ run: |
+ set -euo pipefail
+
+ legacy_owner="${LEGACY_OWNER,,}"
+ if [ "$legacy_owner" = "${GITHUB_REPOSITORY_OWNER,,}" ]; then
+ echo "Legacy owner matches the current owner; nothing to mirror."
+ exit 0
+ fi
+ if [ -z "$LEGACY_TOKEN" ]; then
+ echo "::warning::LEGACY_GHCR_OWNER is set but LEGACY_GHCR_TOKEN is not; skipping the mirror."
+ exit 0
+ fi
+
+ # The pull side needs this login too: it replaces the GITHUB_TOKEN
+ # credential for ghcr.io, and both namespaces are read with it.
+ echo "$LEGACY_TOKEN" | docker login ghcr.io -u "$legacy_owner" --password-stdin
+
+ legacy_image="ghcr.io/${legacy_owner}/${IMAGE_NAME}"
+ while IFS= read -r suffix; do
+ [ -n "$suffix" ] || continue
+ echo "Mirroring ${GHCR_IMAGE}:${suffix} -> ${legacy_image}:${suffix}"
+ docker buildx imagetools create -t "${legacy_image}:${suffix}" "${GHCR_IMAGE}:${suffix}"
+ done <<< "$TAG_SUFFIXES"
diff --git a/.github/workflows/main-image-workflow.yml b/.github/workflows/main-image-workflow.yml
index a1482d9c94..69017308c3 100644
--- a/.github/workflows/main-image-workflow.yml
+++ b/.github/workflows/main-image-workflow.yml
@@ -57,3 +57,4 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ LEGACY_GHCR_TOKEN: ${{ secrets.LEGACY_GHCR_TOKEN }}
diff --git a/.github/workflows/tag-images.yml b/.github/workflows/tag-images.yml
index 450e3ef939..af7c14d939 100644
--- a/.github/workflows/tag-images.yml
+++ b/.github/workflows/tag-images.yml
@@ -73,3 +73,4 @@ jobs:
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ LEGACY_GHCR_TOKEN: ${{ secrets.LEGACY_GHCR_TOKEN }}