diff --git a/.env.example b/.env.example index 60ef3e7..5b3237c 100644 --- a/.env.example +++ b/.env.example @@ -33,6 +33,11 @@ STATION_SWITCH_ENABLED=0 # --- Vision --- # Internal address of the vision worker. Never exposed outside tmflow-net. VISION_WORKER_URL=http://vision:8100 +# The pinned VisionSuite commit, stamped into the vision image at build time +# (Dockerfile.vision ARG). Required: `docker compose build vision` fails +# immediately without it. Set with: +# VISION_ENGINE_VERSION=$(git -C vendor/visionsuite rev-parse HEAD) +VISION_ENGINE_VERSION= # --- File Storage --- # Resolved against the project root in src/backend/config.py. diff --git a/Dockerfile.vision b/Dockerfile.vision index d44d00a..7e29cb1 100644 --- a/Dockerfile.vision +++ b/Dockerfile.vision @@ -24,6 +24,14 @@ COPY src/vision_worker/ ./src/vision_worker/ # VISION_ENGINE_VERSION=$(git -C vendor/visionsuite rev-parse HEAD) \ # docker compose build vision ARG VISION_ENGINE_VERSION +# I4: a build without the commit must fail now, at build time - not later, at +# every request including /health, with a container Docker still reports as +# healthy because no healthcheck existed to say otherwise. +RUN test -n "$VISION_ENGINE_VERSION" || { \ + echo "VISION_ENGINE_VERSION is required. Build with:"; \ + echo ' VISION_ENGINE_VERSION=$(git -C vendor/visionsuite rev-parse HEAD) docker compose build vision'; \ + exit 1; \ + } ENV VISION_ENGINE_VERSION=${VISION_ENGINE_VERSION} EXPOSE 8100 diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 46b54f6..8eb1b35 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -50,6 +50,12 @@ services: VISION_ENGINE_VERSION: ${VISION_ENGINE_VERSION:-} container_name: tmflow-vision restart: unless-stopped + healthcheck: + test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8100/health', timeout=5)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 20s networks: - tmflow-net diff --git a/docker-compose.yml b/docker-compose.yml index b3ead40..57d5c71 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,6 +59,12 @@ services: VISION_ENGINE_VERSION: ${VISION_ENGINE_VERSION:-} container_name: tmflow-vision restart: unless-stopped + healthcheck: + test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8100/health', timeout=5)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 20s networks: - tmflow-net