Harden CPU AI image builds
This commit is contained in:
@@ -265,6 +265,21 @@ def test_backend_docker_context_contains_gis_import_smoke_script() -> None:
|
||||
assert (ROOT / "backend" / "scripts" / "gis_import_smoke.py").exists()
|
||||
|
||||
|
||||
def test_all_in_one_dockerfile_caches_dependencies_and_uses_cpu_torch_for_ai_runtime() -> None:
|
||||
dockerfile = (ROOT / "deploy" / "unraid" / "Dockerfile.all-in-one").read_text(encoding="utf-8")
|
||||
|
||||
metadata_copy_index = dockerfile.index("COPY backend/pyproject.toml backend/README.md /app/")
|
||||
dependency_install_index = dockerfile.index('RUN /usr/bin/python3.11 -m venv /opt/geointel/venv \\')
|
||||
backend_copy_index = dockerfile.index("COPY backend/ /app/")
|
||||
smoke_index = dockerfile.index("RUN python scripts/gis_import_smoke.py")
|
||||
|
||||
assert metadata_copy_index < dependency_install_index < backend_copy_index < smoke_index
|
||||
assert "GEOINTEL_TORCH_INDEX_URL=https://download.pytorch.org/whl/cpu" in dockerfile
|
||||
assert "GEOINTEL_TORCH_VERSION=2.13.0" in dockerfile
|
||||
assert "GEOINTEL_TORCHVISION_VERSION=0.28.0" in dockerfile
|
||||
assert '--index-url "$GEOINTEL_TORCH_INDEX_URL"' in dockerfile
|
||||
|
||||
|
||||
def test_unraid_deploy_passes_ai_build_arg_and_yolo_runtime_env() -> None:
|
||||
deploy_ps1 = (ROOT / "scripts" / "deploy_tower.ps1").read_text(encoding="utf-8")
|
||||
deploy_sh = (ROOT / "scripts" / "deploy_tower.sh").read_text(encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user