deploy: HF Spaces β combined single-container imageWraps our existing 2-service compose into one image that HF Spaces' Docker SDK can run on its standard 7860 port.- Dockerfile (root): three-stage build1. node:20-alpine β npm ci + npm run build (produces ui/dist/)2. python:3.11-slim β pip install into an isolated /opt/venv3. python:3.11-slim + nginx (via apt) + tini as PID 1- docker/nginx.hf.conf: variant listening on 7860, proxies /api β 127.0.0.1:8000- docker/hf-entrypoint.sh: launches uvicorn in the background bound to127.0.0.1:8000 (nginx-only reachable), polls /health for up to 30s songinx isn't serving 502s during boot, then execs nginx in the foreground.Trap forwards SIGTERM to uvicorn for clean shutdown.- README.md: YAML frontmatter block (title, sdk: docker, app_port: 7860)that HF Spaces reads to configure the Space. Also added the π€ HF badgeand a 'Deploy your own' section for anyone forking.CI is unaffected β the existing docker/api.Dockerfile + docker/ui.Dockerfilestill drive the multi-container compose + CI docker-build job. This rootDockerfile is HF-only and doesn't touch the compose stack.
f3aa131 | # ============================================================================ | |
| # HF Spaces nginx config β single-container variant. | |
| # Difference from docker/nginx.conf: listens on 7860 (HF's expected port) and | |
| # proxies /api/* to 127.0.0.1:8000 (same-container uvicorn, not a compose | |
| # service name). | |
| # ============================================================================ | |
| server { | |
| listen 7860; | |
| server_name _; | |
| gzip on; | |
| gzip_types text/plain text/css application/json application/javascript | |
| application/xml+rss text/javascript image/svg+xml; | |
| gzip_min_length 1024; | |
| # Vite-fingerprinted assets β long cache. | |
| location /assets/ { | |
| root /var/www/html; | |
| expires 1y; | |
| add_header Cache-Control "public, immutable"; | |
| } | |
| # Proxy the API β uvicorn is running in the same container, port 8000. | |
| location /api/ { | |
| proxy_pass http://127.0.0.1:8000/; | |
| proxy_http_version 1.1; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header X-Forwarded-Proto $scheme; | |
| proxy_connect_timeout 10s; | |
| proxy_read_timeout 120s; | |
| client_max_body_size 20m; | |
| } | |
| # SPA fallback β everything else goes to index.html. | |
| location / { | |
| root /var/www/html; | |
| index index.html; | |
| try_files $uri $uri/ /index.html; | |
| } | |
| } | |