From f5827b52d330fd0f05f242c114f87862e9238607 Mon Sep 17 00:00:00 2001 From: Xiaoxia AI Date: Mon, 22 Jun 2026 10:04:26 +0800 Subject: [PATCH] fix(deploy): skip runtime image builds on production host --- infra/docker/deploy-production.sh | 8 ++++++-- tests/unit/test_release_scripts.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/infra/docker/deploy-production.sh b/infra/docker/deploy-production.sh index 58d0b63ca..a2a785c53 100755 --- a/infra/docker/deploy-production.sh +++ b/infra/docker/deploy-production.sh @@ -46,8 +46,12 @@ export COMPOSE_PROJECT_NAME=xiaoxia-production-app export WEB_DOCKERFILE=infra/docker/web-artifact.Dockerfile export WEB_NGINX_CONF=infra/docker/nginx-production.conf -docker compose --env-file "$ENV_FILE" build --pull=false api -docker compose --env-file "$ENV_FILE" build --pull=false worker +if [ "${ALLOW_PRODUCTION_BUILDS:-false}" = "true" ]; then + docker compose --env-file "$ENV_FILE" build --pull=false api + docker compose --env-file "$ENV_FILE" build --pull=false worker +else + echo "Skipping production API/worker image builds. Set ALLOW_PRODUCTION_BUILDS=true only on a dedicated build host." +fi docker compose --env-file "$ENV_FILE" build --pull=false web docker compose --env-file "$ENV_FILE" run --rm --no-deps api sh -c ' cd /app && diff --git a/tests/unit/test_release_scripts.py b/tests/unit/test_release_scripts.py index 56f080348..1774813a5 100644 --- a/tests/unit/test_release_scripts.py +++ b/tests/unit/test_release_scripts.py @@ -27,6 +27,8 @@ def test_deploy_production_uses_production_infra_and_project(): assert "Production deploy must not build frontend assets on the server" in script assert "WEB_DOCKERFILE=infra/docker/web-artifact.Dockerfile" in script assert "WEB_NGINX_CONF=infra/docker/nginx-production.conf" in script + assert "Skipping production API/worker image builds" in script + assert "ALLOW_PRODUCTION_BUILDS=true" in script assert "xiaoxia-postgres-production" in script assert "xiaoxia-redis-production" in script assert "xiaoxia-postgres\n" not in script