fix(deploy): skip runtime image builds on production host

This commit is contained in:
Xiaoxia AI
2026-06-22 10:04:26 +08:00
parent 9ac9ba8184
commit e0aabc8e87
2 changed files with 8 additions and 2 deletions
+6 -2
View File
@@ -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 &&
+2
View File
@@ -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