diff --git a/docker/docker-compose.deploy.yml b/docker/docker-compose.deploy.yml index be40cb02..7090614b 100644 --- a/docker/docker-compose.deploy.yml +++ b/docker/docker-compose.deploy.yml @@ -11,6 +11,8 @@ services: - .env ports: - "8200:8000" + # 必须大于内部关闭预算 20s,否则 SIGKILL 可能打断优雅关闭流程。 + stop_grace_period: 30s volumes: - ./config:/app/config - ./data:/app/data diff --git a/tests/deployment/test_pull_and_deploy.py b/tests/deployment/test_pull_and_deploy.py index d34b7c46..f6687678 100644 --- a/tests/deployment/test_pull_and_deploy.py +++ b/tests/deployment/test_pull_and_deploy.py @@ -3,6 +3,8 @@ import time from pathlib import Path +import yaml + SCRIPT = Path(__file__).parents[2] / "docker" / "pull_and_deploy.sh" PUSH_SCRIPT = Path(__file__).parents[2] / "docker" / "push_to_ghcr.sh" @@ -444,6 +446,12 @@ def test_compose_template_uses_legacy_compatible_env_file_syntax(): assert "- .env" in source +def test_compose_template_sets_stop_grace_period(): + source = (SCRIPT.parent / "docker-compose.deploy.yml").read_text(encoding="utf-8") + compose = yaml.safe_load(source) + assert compose["services"]["video-transcript-api"]["stop_grace_period"] == "30s" + + def test_build_script_uses_only_git_sha_tag(): source = PUSH_SCRIPT.read_text(encoding="utf-8") assert 'IMAGE_REF="${REGISTRY_IMAGE}:${GIT_SHA}"' in source