services: backend: build: ./backend restart: unless-stopped # Only expose 8080 if you need direct access during development. # In production, the frontend nginx proxies all traffic — comment this out. # ports: # - "8080:8080" env_file: - ./backend/.env # CLERK_SECRET_KEY, GEMINI_API_KEY, etc. environment: NODE_ENV: production PORT: 8080 DB_PATH: /app/data/game.db volumes: # Persist the SQLite database across container restarts / redeploys - sqlite_data:/app/data # Cache the downloaded Qwen ONNX model (~300 MB) so it is not # re-downloaded every time the container restarts. - hf_model_cache:/root/.cache/huggingface healthcheck: test: [ "CMD", "node", "-e", "require('http').get('http://localhost:8080/health', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))", ] interval: 30s timeout: 10s retries: 5 start_period: 120s # allow extra time for first-run Qwen model download frontend: build: context: ./frontend args: # Empty = connect to the same origin; nginx proxies /socket.io/ to backend. VITE_API_URL: "" # Set your Clerk publishable key here (or pass via --build-arg). VITE_CLERK_PUBLISHABLE_KEY: "pk_test_c3RpbGwtY3JhbmUtNTAuY2xlcmsuYWNjb3VudHMuZGV2JA" restart: unless-stopped ports: - "8090:80" depends_on: backend: condition: service_healthy volumes: sqlite_data: hf_model_cache: