Spaces:
Running
Running
File size: 2,487 Bytes
f381be8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 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
|