version: '3.8' services: app: build: context: .. dockerfile: docker/Dockerfile ports: - "${PORT:-3000}:3000" environment: - NODE_ENV=production - PORT=3000 - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD:-postgres}@db:5432/chaaskit?schema=public - SESSION_SECRET=${SESSION_SECRET:?SESSION_SECRET is required} - JWT_SECRET=${JWT_SECRET:?JWT_SECRET is required} - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-} - OPENAI_API_KEY=${OPENAI_API_KEY:-} - STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY:-} - STRIPE_WEBHOOK_SECRET=${STRIPE_WEBHOOK_SECRET:-} - STRIPE_BASIC_PRICE_ID=${STRIPE_BASIC_PRICE_ID:-} - STRIPE_PRO_PRICE_ID=${STRIPE_PRO_PRICE_ID:-} - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID:-} - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET:-} - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID:-} - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET:-} - APP_URL=${APP_URL:-http://localhost:3000} - API_URL=${API_URL:-http://localhost:3000} depends_on: db: condition: service_healthy restart: unless-stopped healthcheck: test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"] interval: 30s timeout: 10s retries: 3 start_period: 10s db: image: postgres:16-alpine environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres} - POSTGRES_DB=chaaskit volumes: - postgres_data:/var/lib/postgresql/data ports: - "${DB_PORT:-5432}:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"] interval: 5s timeout: 5s retries: 5 restart: unless-stopped # Run database migrations on startup migrate: build: context: .. dockerfile: docker/Dockerfile command: ["npx", "prisma", "db", "push", "--skip-generate"] working_dir: /app/packages/db environment: - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD:-postgres}@db:5432/chaaskit?schema=public depends_on: db: condition: service_healthy restart: "no" volumes: postgres_data: