ci: enforce cloud image pull only; remove local build from compose
Some checks failed
Deploy Noval to K3s / deploy (push) Has been cancelled
Some checks failed
Deploy Noval to K3s / deploy (push) Has been cancelled
This commit is contained in:
@@ -45,26 +45,18 @@ jobs:
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# 优先使用 docker-compose.yml 中配置的云端镜像
|
# 100% 使用 docker-compose.yml 中配置的云端镜像(不再本地构建)
|
||||||
COMPOSE_IMAGE=$(docker compose config --images | head -n 1 || true)
|
COMPOSE_IMAGE=$(docker compose config --images | head -n 1 || true)
|
||||||
|
|
||||||
if [ -n "${COMPOSE_IMAGE}" ]; then
|
if [ -z "${COMPOSE_IMAGE}" ]; then
|
||||||
echo "☁️ 检测到 compose 镜像: ${COMPOSE_IMAGE},优先从云端拉取"
|
echo "❌ docker-compose.yml 未配置 image,无法走云端 pull"
|
||||||
pull_with_retry "${COMPOSE_IMAGE}"
|
exit 1
|
||||||
FULL_IMAGE="${COMPOSE_IMAGE}"
|
|
||||||
else
|
|
||||||
FULL_IMAGE="${IMAGE_NAME}:${NEW_COMMIT_SHA}"
|
|
||||||
echo "ℹ️ compose 未配置 image,回退本地构建模式"
|
|
||||||
|
|
||||||
echo "🌐 预拉取基础镜像(带重试,避免网络抖动)..."
|
|
||||||
pull_with_retry node:20-alpine
|
|
||||||
pull_with_retry python:3.12-slim
|
|
||||||
|
|
||||||
echo "📦 构建镜像 ${FULL_IMAGE}"
|
|
||||||
docker build --pull=false -t "${FULL_IMAGE}" .
|
|
||||||
docker tag "${FULL_IMAGE}" "${IMAGE_NAME}:latest"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "☁️ 使用云端镜像: ${COMPOSE_IMAGE}"
|
||||||
|
pull_with_retry "${COMPOSE_IMAGE}"
|
||||||
|
FULL_IMAGE="${COMPOSE_IMAGE}"
|
||||||
|
|
||||||
if command -v k3s >/dev/null 2>&1; then
|
if command -v k3s >/dev/null 2>&1; then
|
||||||
echo "📤 导入镜像到 k3s containerd..."
|
echo "📤 导入镜像到 k3s containerd..."
|
||||||
docker save "${FULL_IMAGE}" | k3s ctr images import -
|
docker save "${FULL_IMAGE}" | k3s ctr images import -
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
noval:
|
noval:
|
||||||
image: crpi-om2xd9y8cmaizszf.cn-beijing.personal.cr.aliyuncs.com/test-namespace-gu/writing-reddot:latest
|
image: crpi-om2xd9y8cmaizszf.cn-beijing.personal.cr.aliyuncs.com/test-namespace-gu/writing-reddot:latest
|
||||||
build: .
|
|
||||||
container_name: noval
|
container_name: noval
|
||||||
ports:
|
ports:
|
||||||
- "80:8000"
|
- "80:8000"
|
||||||
|
|||||||
Reference in New Issue
Block a user