Files
TieMeasureFlow/docker-compose.yml
T
Adriano 46566ebfa5 fix(vision): build fallisce senza VISION_ENGINE_VERSION, healthcheck vero
Un build senza la variabile produceva un'immagine che partiva e
rispondeva "healthy" pur fallendo ogni richiesta, /health incluso: non
c'era un healthcheck a dirlo. Tre correzioni: RUN test -n
"$VISION_ENGINE_VERSION" in Dockerfile.vision dopo l'ARG, fallisce
subito con il comando da lanciare; healthcheck su /health nel servizio
vision di entrambi i compose; VISION_ENGINE_VERSION documentata in
.env.example accanto a VISION_WORKER_URL, che già c'era.

Verificato con docker build reale: senza la variabile fallisce al passo
del test con il messaggio atteso; con la variabile impostata l'immagine
si costruisce, il container parte, e python3 -c
"urllib.request.urlopen('http://localhost:8100/health')" - lo stesso
comando usato nell'healthcheck - risponde 200 con l'engine_version
giusta.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BBnuACZSCJqXrMYC3LUMU
2026-08-16 19:43:20 +02:00

115 lines
3.5 KiB
YAML

services:
mysql:
image: mysql:8.0
container_name: tmflow-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-root_password_change_me}
MYSQL_DATABASE: ${DB_NAME:-tiemeasureflow}
MYSQL_USER: ${DB_USER:-tmflow}
MYSQL_PASSWORD: ${DB_PASSWORD:-change_me_in_production}
volumes:
- mysql_data:/var/lib/mysql
command: >
--authentication-policy=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
networks:
- tmflow-net
server:
build:
context: .
dockerfile: Dockerfile
container_name: tmflow-server
restart: unless-stopped
env_file:
- .env
environment:
DB_HOST: mysql
UPLOAD_DIR: uploads
VISION_WORKER_URL: http://vision:8100
volumes:
- upload_data:/app/uploads
depends_on:
mysql:
condition: service_healthy
labels:
- "traefik.enable=true"
- "traefik.http.routers.tmflow-api.rule=Host(`tieflow.tielogic.xyz`) && (PathPrefix(`/api/`) || PathPrefix(`/uploads/`))"
- "traefik.http.routers.tmflow-api.entrypoints=web,websecure"
- "traefik.http.routers.tmflow-api.tls=true"
- "traefik.http.routers.tmflow-api.tls.certresolver=mytlschallenge"
- "traefik.http.routers.tmflow-api.priority=100"
- "traefik.http.services.tmflow-api.loadbalancer.server.port=8000"
networks:
- tmflow-net
- traefik-net
vision:
build:
context: .
dockerfile: Dockerfile.vision
args:
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
client:
build:
context: .
dockerfile: Dockerfile.frontend
container_name: tmflow-client
restart: unless-stopped
env_file:
- .env
environment:
API_SERVER_URL: http://server:8000
depends_on:
- server
labels:
- "traefik.enable=true"
- "traefik.http.routers.tmflow-web.rule=Host(`tieflow.tielogic.xyz`)"
- "traefik.http.routers.tmflow-web.entrypoints=web,websecure"
- "traefik.http.routers.tmflow-web.tls=true"
- "traefik.http.routers.tmflow-web.tls.certresolver=mytlschallenge"
- "traefik.http.routers.tmflow-web.priority=10"
- "traefik.http.services.tmflow-web.loadbalancer.server.port=5000"
- "traefik.http.middlewares.tmflow-headers.headers.SSLRedirect=true"
- "traefik.http.middlewares.tmflow-headers.headers.STSSeconds=315360000"
- "traefik.http.middlewares.tmflow-headers.headers.browserXSSFilter=true"
- "traefik.http.middlewares.tmflow-headers.headers.contentTypeNosniff=true"
- "traefik.http.middlewares.tmflow-headers.headers.forceSTSHeader=true"
- "traefik.http.middlewares.tmflow-headers.headers.STSIncludeSubdomains=true"
- "traefik.http.middlewares.tmflow-headers.headers.STSPreload=true"
- "traefik.http.routers.tmflow-web.middlewares=tmflow-headers"
networks:
- tmflow-net
- traefik-net
volumes:
mysql_data:
driver: local
upload_data:
driver: local
networks:
tmflow-net:
driver: bridge
traefik-net:
external: true
name: traefik