- README 快速开始新增方式一:docker pull gitea.88531.cn/jinghui/unicut:latest 免构建直接起 - 新增 scripts/push_registry.sh:docker save → skopeo 内网直推,绕过公网 nginx 413 体积上限 - 已推送 latest + v1.0.0 两 tag,端到端验证:公网 docker pull 成功、匿名可拉 - 腾讯云 TCR 待补凭据后推送
42 lines
1.7 KiB
Bash
42 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
||
# 发版推送 unicut 镜像到自建 Gitea Registry(gitea.88531.cn)
|
||
#
|
||
# 为什么用 skopeo 走内网直推:
|
||
# 公网链路(VPS nginx → 隧道 → Gitea)带 client_max_body_size 限制,
|
||
# docker push 大层会被 413 Request Entity Too Large 拦下;
|
||
# 内网 http://192.168.68.19:3200 直推无此限制,推完公网 gitea.88531.cn
|
||
# 即可拉取(拉取是 GET 响应,不受请求体积限制影响)。
|
||
#
|
||
# 用法:bash scripts/push_registry.sh [镜像:tag] [版本tag]
|
||
# 默认:unicut-src-unicut:latest → :latest + :v1.0.0
|
||
set -euo pipefail
|
||
|
||
IMG="${1:-unicut-src-unicut:latest}"
|
||
VERSION_TAG="${2:-v1.0.0}"
|
||
REG="192.168.68.19:3200" # 内网 Gitea(绕开公网 nginx)
|
||
OWNER="jinghui"
|
||
PKG="unicut"
|
||
TOKEN="$(sed 's/^Bearer //' /root/.gitea_token)"
|
||
TMP="$(mktemp -d /tmp/push_registry.XXXXXX)"
|
||
trap 'rm -rf "$TMP"' EXIT
|
||
|
||
echo "[1/3] docker save ${IMG} → ${TMP}/img.tar"
|
||
docker save "${IMG}" -o "${TMP}/img.tar"
|
||
|
||
echo "[2/3] 推送 latest → ${REG}/${OWNER}/${PKG}:latest"
|
||
skopeo copy \
|
||
--dest-tls-verify=false --dest-username="${OWNER}" --dest-password="${TOKEN}" \
|
||
"docker-archive:${TMP}/img.tar:${IMG}" \
|
||
"docker://${REG}/${OWNER}/${PKG}:latest"
|
||
|
||
echo "[3/3] 同步版本 tag → :${VERSION_TAG}"
|
||
skopeo copy \
|
||
--src-tls-verify=false --src-username="${OWNER}" --src-password="${TOKEN}" \
|
||
--dest-tls-verify=false --dest-username="${OWNER}" --dest-password="${TOKEN}" \
|
||
"docker://${REG}/${OWNER}/${PKG}:latest" \
|
||
"docker://${REG}/${OWNER}/${PKG}:${VERSION_TAG}"
|
||
|
||
echo "完成。公网免登录可拉:"
|
||
echo " docker pull gitea.88531.cn/${OWNER}/${PKG}:latest"
|
||
echo " docker pull gitea.88531.cn/${OWNER}/${PKG}:${VERSION_TAG}"
|