672f5b74a4
Frontend container now uses nginx to serve static files and proxy /api/* requests to the backend container internally, eliminating the hardcoded localhost:8000 build-time URL that caused "Network error" on any non-local server. CORS origins are also configurable via ALLOWED_ORIGINS env var. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
36 lines
912 B
YAML
36 lines
912 B
YAML
services:
|
|
backend:
|
|
build: ./backend
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
- ./data:/app/data
|
|
environment:
|
|
- DATABASE_URL=sqlite:////app/data/btc_portfolio.db
|
|
- SECRET_KEY=${SECRET_KEY:-dev-insecure-key-change-me}
|
|
- ALLOWED_ORIGINS=${ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:3001}
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/')"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 15s
|
|
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
args:
|
|
- REACT_APP_API_URL=/api
|
|
ports:
|
|
- "3001:80"
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:80/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 20s
|