Spaces:
Running
Running
| version: "3.9" | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # AI Battery Lifecycle Predictor β Docker Compose | |
| # | |
| # Services | |
| # ββββββββ | |
| # app Production: single container (React SPA + FastAPI, port 7860) | |
| # api-dev Development: backend only with hot-reload (activate with --profile dev) | |
| # | |
| # Usage | |
| # βββββ | |
| # Production: docker compose up --build | |
| # Development: docker compose --profile dev up api-dev | |
| # (then separately: cd frontend && npm run dev) | |
| # βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| services: | |
| # ββ Production ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| app: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| image: battery-lifecycle:latest | |
| container_name: battery_lifecycle | |
| ports: | |
| - "7860:7860" | |
| environment: | |
| LOG_LEVEL: "INFO" | |
| WORKERS: "1" | |
| volumes: | |
| # Persist rotated log files on the host | |
| - ./artifacts/logs:/app/artifacts/logs | |
| healthcheck: | |
| test: | |
| - CMD | |
| - python | |
| - -c | |
| - "import urllib.request; urllib.request.urlopen('http://localhost:7860/health')" | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 90s # give models time to load | |
| restart: unless-stopped | |
| # ββ Development (backend only, hot-reload) ββββββββββββββββββββββββββββββββββ | |
| api-dev: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| target: runtime # stop before copying built frontend | |
| image: battery-lifecycle:dev | |
| container_name: battery_lifecycle_dev | |
| command: > | |
| uvicorn api.main:app | |
| --host 0.0.0.0 | |
| --port 7860 | |
| --reload | |
| ports: | |
| - "7860:7860" | |
| environment: | |
| LOG_LEVEL: "DEBUG" | |
| volumes: | |
| - ./api:/app/api # live-reload source changes | |
| - ./src:/app/src | |
| - ./artifacts:/app/artifacts | |
| profiles: | |
| - dev | |