deploy: Dockerfile + docker-compose Traefik per VPS pm.tielogic.xyz

Dockerfile (multi-arch, python 3.13-slim):
- uv copiato da ghcr.io/astral-sh/uv per install deps
- System deps: libgl1 libglib2.0-0 (cv2) + libgomp1 (numba)
- uv sync --frozen --no-dev da uv.lock
- ENV: IMAGES_DIR=/data/images, HOST=0.0.0.0, PORT=8080
- HEALTHCHECK su GET /images ogni 30s

docker-compose.yml:
- Service pm2d con image ${REGISTRY}/pm2d:${TAG}
- Volume ./images:/data/images (persistenza upload/UI)
- Network esterna 'traefik' (adattare se diverso)
- Labels Traefik:
  - Router HTTPS Host(pm.tielogic.xyz) entrypoint websecure TLS letsencrypt
  - Middleware bodysize 50MB (upload multipart)
  - Redirect HTTP->HTTPS automatico

main.py: HOST/PORT da env (default 127.0.0.1:8080 per dev locale).

README: sezione Deploy con build/push/run su VPS.

.dockerignore: esclude .venv, Test/, benchmarks/, md files.

Build + smoke test container: OK su port 18080.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 15:55:16 +02:00
parent 3e4c20ecf5
commit 71a364a1fd
5 changed files with 162 additions and 3 deletions
+7 -3
View File
@@ -1,10 +1,14 @@
"""Entry-point PM2D — webapp HTML.
Esegui: uv run python main.py
Apri: http://127.0.0.1:8080/
Esegui locale: uv run python main.py (default 127.0.0.1:8080)
Container: HOST=0.0.0.0 PORT=8080 python main.py
"""
import os
from pm2d.web.server import serve
if __name__ == "__main__":
serve(host="127.0.0.1", port=8080)
host = os.environ.get("HOST", "127.0.0.1")
port = int(os.environ.get("PORT", "8080"))
serve(host=host, port=port)