services: # PostgreSQL Database postgres: image: postgres:16-alpine container_name: elearning-postgres restart: unless-stopped security_opt: - apparmor=unconfined ports: - "5432:5432" environment: POSTGRES_DB: elearning_dev POSTGRES_PASSWORD: 12345678 volumes: - postgres_data:/var/lib/postgresql/data networks: - elearning-network healthcheck: test: [ "CMD-SHELL", "pg_isready -U elearning" ] interval: 10s timeout: 5s retries: 5 # MinIO - S3 Compatible Storage minio: image: minio/minio:latest deploy: resources: limits: memory: 1G container_name: elearning-minio restart: unless-stopped security_opt: - apparmor=unconfined ports: - "9000:9000" # API - "9001:9001" # Console environment: - TZ=Asia/Bangkok - MINIO_ROOT_USER=admin - MINIO_ROOT_PASSWORD=12345678 volumes: - minio_data:/data command: server /data --console-address ":9001" networks: - elearning-network healthcheck: test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ] interval: 30s timeout: 20s retries: 3 # Mailhog - Email Testing mailhog: image: mailhog/mailhog:latest container_name: elearning-mailhog restart: unless-stopped security_opt: - apparmor=unconfined ports: - "1025:1025" # SMTP - "8025:8025" # Web UI networks: - elearning-network # Backend API (Local Build) backend: build: context: . dockerfile: Dockerfile container_name: elearning-backend-local restart: unless-stopped ports: - "4000:4000" env_file: - .env environment: - NODE_ENV=development - DATABASE_URL=postgresql://postgres:12345678@postgres:5432/elearning_dev - S3_ENDPOINT=http://minio:9000 - S3_ACCESS_KEY=admin - S3_SECRET_KEY=12345678 - SMTP_HOST=mailhog - SMTP_PORT=1025 volumes: - ./src:/app/src - ./prisma:/app/prisma networks: - elearning-network depends_on: postgres: condition: service_healthy minio: condition: service_healthy mailhog: condition: service_started healthcheck: test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4000/health" ] interval: 30s timeout: 10s retries: 3 start_period: 40s # Adminer - Database Management UI adminer: image: adminer:latest container_name: elearning-adminer restart: unless-stopped security_opt: - apparmor=unconfined ports: - "8080:8080" environment: ADMINER_DEFAULT_SERVER: postgres ADMINER_DESIGN: dracula networks: - elearning-network depends_on: - postgres volumes: postgres_data: driver: local minio_data: driver: local networks: elearning-network: driver: bridge