From cc0303c65e66aad93aa4108000aa6ebd690e7659 Mon Sep 17 00:00:00 2001 From: zyycn Date: Mon, 27 Jul 2026 01:51:51 +0800 Subject: [PATCH] ci: drop the dead Dockerfile stage and sanitize the build-metadata image tag Remove the release-asset build stages that nothing references. Strip the +build semver metadata from the derived container tag, which is not a legal tag character, while keeping the full version string where a tag is not required. Co-authored-by: Claude --- .github/workflows/release.yml | 17 ++++++++++------- deploy/Dockerfile | 18 ------------------ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fae1166a0..a3cc5789c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,7 @@ jobs: outputs: tag: ${{ steps.version.outputs.tag }} version: ${{ steps.version.outputs.version }} + docker_version: ${{ steps.version.outputs.docker_version }} build_time: ${{ steps.version.outputs.build_time }} git_sha: ${{ steps.version.outputs.git_sha }} platform_matrix: ${{ steps.version.outputs.platform_matrix }} @@ -146,6 +147,8 @@ jobs: puts "tag=#{release_tag}" puts "version=#{version}" + # Docker tags forbid "+", so semver build metadata maps to "-" in image tags. + puts "docker_version=#{version.tr("+", "-")}" puts "build_time=#{Time.now.utc.iso8601}" puts "git_sha=#{git_sha.strip}" puts "platform_matrix=#{matrix}" @@ -539,7 +542,7 @@ jobs: id: manifest shell: bash env: - VERSION: ${{ needs.release-info.outputs.version }} + DOCKER_VERSION: ${{ needs.release-info.outputs.docker_version }} GIT_SHA: ${{ needs.release-info.outputs.git_sha }} DOCKER_PLATFORMS: ${{ needs.release-info.outputs.docker_platforms }} PRERELEASE: ${{ needs.release-info.outputs.prerelease }} @@ -562,7 +565,7 @@ jobs: fi target_args=( - -t "${image}:${VERSION}" + -t "${image}:${DOCKER_VERSION}" -t "${image}:sha-${GIT_SHA}" ) if [ "$PRERELEASE" != true ]; then @@ -570,7 +573,7 @@ jobs: fi docker buildx imagetools create "${target_args[@]}" "${sources[@]}" - inspect_output="$(docker buildx imagetools inspect "${image}:${VERSION}")" + inspect_output="$(docker buildx imagetools inspect "${image}:${DOCKER_VERSION}")" platform_list="$(awk '$1 == "Platform:" { print $2 }' <<< "${inspect_output}")" for platform in "${platforms[@]}"; do if ! grep -Eq "^${platform}(/|$)" <<< "${platform_list}"; then @@ -580,7 +583,7 @@ jobs: fi done - digest="$(docker buildx imagetools inspect "${image}:${VERSION}" --format '{{ .Manifest.Digest }}')" + digest="$(docker buildx imagetools inspect "${image}:${DOCKER_VERSION}" --format '{{ .Manifest.Digest }}')" if [ -z "${digest}" ]; then echo "missing image digest" exit 1 @@ -598,7 +601,7 @@ jobs: shell: bash env: DIGEST: ${{ steps.manifest.outputs.digest }} - VERSION: ${{ needs.release-info.outputs.version }} + DOCKER_VERSION: ${{ needs.release-info.outputs.docker_version }} GIT_SHA: ${{ needs.release-info.outputs.git_sha }} PRERELEASE: ${{ needs.release-info.outputs.prerelease }} run: | @@ -609,7 +612,7 @@ jobs: fi image="${REGISTRY}/${IMAGE_NAME}" - tags=("${image}:${VERSION}" "${image}:sha-${GIT_SHA}") + tags=("${image}:${DOCKER_VERSION}" "${image}:sha-${GIT_SHA}") if [ "$PRERELEASE" != true ]; then tags+=("${image}:latest") fi @@ -637,7 +640,7 @@ jobs: **Docker:** ```bash # GitHub Container Registry - docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release-info.outputs.version }} + docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.release-info.outputs.docker_version }} ``` **Manual download:** diff --git a/deploy/Dockerfile b/deploy/Dockerfile index 28a28aa2d..4ad45eab0 100644 --- a/deploy/Dockerfile +++ b/deploy/Dockerfile @@ -33,24 +33,6 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ cargo build --release --locked --bin codex-proxy-rs \ && cp "${CARGO_TARGET_DIR}/release/codex-proxy-rs" /tmp/codex-proxy-rs -FROM backend-builder AS release-asset-builder - -ARG TARGETOS -ARG TARGETARCH - -WORKDIR /out -COPY --from=frontend-builder /app/frontend/dist /tmp/release/codex-proxy-rs/web/dist -RUN test -n "${CPR_VERSION}" \ - && test -n "${TARGETOS}" \ - && test -n "${TARGETARCH}" \ - && cp /tmp/codex-proxy-rs /tmp/release/codex-proxy-rs/ \ - && tar -czf "/out/codex-proxy-rs_${CPR_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz" \ - -C /tmp/release codex-proxy-rs - -FROM scratch AS release-asset - -COPY --from=release-asset-builder /out / - FROM debian:bookworm-slim@sha256:7b140f374b289a7c2befc338f42ebe6441b7ea838a042bbd5acbfca6ec875818 AS runtime-base ENV TZ=Asia/Shanghai