aiBatteryLifeCycle / docker-compose.yml
NeerajCodz's picture
feat: full project β€” ML simulation, dashboard UI, models on HF Hub
f381be8
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