# QuantDinger Docker Compose - One-Click Deployment # Usage: # 1. Copy .env.example to .env and edit your settings # 2. docker-compose up -d # 3. Open http://localhost:8888 version: '3.8' services: # ======================== # PostgreSQL Database # ======================== postgres: image: postgres:16-alpine container_name: quantdinger-db restart: unless-stopped environment: POSTGRES_DB: ${POSTGRES_DB:-quantdinger} POSTGRES_USER: ${POSTGRES_USER:-quantdinger} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-quantdinger123} TZ: ${TZ:-Asia/Shanghai} volumes: - postgres_data:/var/lib/postgresql/data - ./backend_api_python/migrations/init.sql:/docker-entrypoint-initdb.d/01-init.sql ports: - "${DB_PORT:-127.0.0.1:5432}:5432" networks: - quantdinger-network healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-quantdinger} -d ${POSTGRES_DB:-quantdinger}"] interval: 10s timeout: 5s retries: 5 # ======================== # Backend API (Python/Flask) # ======================== backend: build: context: ./backend_api_python dockerfile: Dockerfile container_name: quantdinger-backend restart: unless-stopped depends_on: postgres: condition: service_healthy ports: - "${BACKEND_PORT:-127.0.0.1:5000}:5000" volumes: - backend_logs:/app/logs - backend_data:/app/data # Mount .env for runtime config - ./backend_api_python/.env:/app/.env:ro environment: - PYTHON_API_HOST=0.0.0.0 - PYTHON_API_PORT=5000 - TZ=${TZ:-Asia/Shanghai} - DATABASE_URL=postgresql://${POSTGRES_USER:-quantdinger}:${POSTGRES_PASSWORD:-quantdinger123}@postgres:5432/${POSTGRES_DB:-quantdinger} - DB_TYPE=postgresql networks: - quantdinger-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost:5000/api/health"] interval: 30s timeout: 10s retries: 3 # ======================== # Frontend (Nginx + Pre-built) # ======================== frontend: build: context: ./frontend dockerfile: Dockerfile container_name: quantdinger-frontend restart: unless-stopped ports: - "${FRONTEND_PORT:-8888}:80" depends_on: - backend networks: - quantdinger-network healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 10s retries: 3 volumes: postgres_data: driver: local backend_logs: driver: local backend_data: driver: local networks: quantdinger-network: driver: bridge