# Docker Compose configuration for ChatTutor # This file references the main configuration in the docker/ directory services: # PostgreSQL Database postgres: image: postgres:16-alpine container_name: chattutor-postgres restart: unless-stopped environment: POSTGRES_DB: chattutor POSTGRES_USER: chattutor POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme} volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U chattutor"] interval: 10s timeout: 5s retries: 5 # ChatTutor Application app: build: context: . dockerfile: docker/Dockerfile container_name: chattutor-app restart: unless-stopped ports: - "3000:3000" environment: # Database DATABASE_URL: postgresql://chattutor:${POSTGRES_PASSWORD:-changeme}@postgres:5432/chattutor # AI Configuration API_KEY: ${API_KEY} BASE_URL: ${BASE_URL:-https://api.openai.com/v1} AGENT_MODEL: ${AGENT_MODEL} TITLE_MODEL: ${TITLE_MODEL:-} # OSS Configuration (Optional) OSS_ENDPOINT: ${OSS_ENDPOINT:-} OSS_ACCESS_KEY: ${OSS_ACCESS_KEY:-} OSS_SECRET_KEY: ${OSS_SECRET_KEY:-} OSS_BUCKET: ${OSS_BUCKET:-} OSS_REGION: ${OSS_REGION:-} # Node Environment NODE_ENV: production # Database initialization (set to true to skip auto-init) SKIP_DB_INIT: ${SKIP_DB_INIT:-false} depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"] interval: 30s timeout: 3s start_period: 40s retries: 3 volumes: postgres_data: driver: local