fix(release): prevent runtime builds on production host
This commit is contained in:
@@ -20,6 +20,14 @@ TAR_PATH="$OUTPUT_DIR/xiaoxia-runtime-images-$VERSION.tar"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
if docker ps --format '{{.Names}}' | grep -Eq '^(xiaoxia-(api|web|worker|postgres|redis)-production|gitea)$'; then
|
||||
if [ "${ALLOW_SHARED_PRODUCTION_BUILD_HOST:-false}" != "true" ]; then
|
||||
echo "Refusing to build runtime images on a host that is running production services."
|
||||
echo "Use a dedicated build host/CI runner, or set ALLOW_SHARED_PRODUCTION_BUILD_HOST=true only for an explicitly approved emergency."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
docker build --pull=false -f infra/docker/api.Dockerfile -t "$API_IMAGE" -t "$API_LATEST" .
|
||||
docker build --pull=false -f infra/docker/worker.Dockerfile -t "$WORKER_IMAGE" -t "$WORKER_LATEST" .
|
||||
docker save "$API_IMAGE" "$API_LATEST" "$WORKER_IMAGE" "$WORKER_LATEST" -o "$TAR_PATH"
|
||||
|
||||
Reference in New Issue
Block a user