71da162e1f
Container FastAPI separato (Dockerfile.vision, python:3.13-slim) che espone run_graph/engine_version del Task 2 via POST /run e GET /health, cosi' l'immagine del server principale non importa mai VisionSuite. engine_version() ora legge VISION_ENGINE_VERSION se impostata, altrimenti ricade su git rev-parse nel checkout di sviluppo, e non inventa mai un valore: senza nessuna delle due solleva un errore esplicito. Nel container il fallback a git non puo' funzionare (.git del submodule punta fuori dal build context), quindi Dockerfile.vision prende il commit come build arg e lo fissa in ambiente; i compose file lo passano da VISION_ENGINE_VERSION. Nessuna porta pubblicata e nessuna label Traefik sul servizio vision: e' raggiungibile solo dal server, su tmflow-net. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014BBnuACZSCJqXrMYC3LUMU
34 lines
1.3 KiB
Docker
34 lines
1.3 KiB
Docker
FROM python:3.13-slim
|
|
|
|
# opencv-python (pulled in transitively by vs-core/vs-task/vs-measure/vs-pm2d)
|
|
# needs libGL and glib at runtime even though it is never imported by name here.
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libgl1 libglib2.0-0 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
|
|
WORKDIR /app
|
|
COPY pyproject.toml uv.lock ./
|
|
COPY vendor/ ./vendor/
|
|
RUN uv sync --extra vision --frozen --no-dev
|
|
|
|
COPY src/vision/ ./src/vision/
|
|
COPY src/vision_worker/ ./src/vision_worker/
|
|
|
|
# Ruling R8: the version is stamped at build time, not discovered at runtime.
|
|
# COPY vendor/ above does not bring vendor/visionsuite/.git along - it is a
|
|
# gitlink file pointing at ../../.git/modules/vendor/visionsuite, which lives
|
|
# outside the build context - so `git rev-parse HEAD` cannot work in here.
|
|
# Pass the submodule's commit in from the host, which does have git:
|
|
# VISION_ENGINE_VERSION=$(git -C vendor/visionsuite rev-parse HEAD) \
|
|
# docker compose build vision
|
|
ARG VISION_ENGINE_VERSION
|
|
ENV VISION_ENGINE_VERSION=${VISION_ENGINE_VERSION}
|
|
|
|
EXPOSE 8100
|
|
|
|
# Two workers, not four: each holds the vision stack in memory.
|
|
CMD ["uv", "run", "uvicorn", "src.vision_worker.main:app", \
|
|
"--host", "0.0.0.0", "--port", "8100", "--workers", "2"]
|