elearning/Backend/compose.yaml
JakkrapartXD d2e78dcfbb
All checks were successful
Build and Deploy Backend / Build Backend Docker Image (push) Successful in 32s
Build and Deploy Frontend Learner / Build Frontend Learner Docker Image (push) Successful in 34s
Build and Deploy Backend / Deploy E-learning Backend to Dev Server (push) Successful in 3s
Build and Deploy Frontend Learner / Deploy E-learning Frontend Learner to Dev Server (push) Successful in 2s
Build and Deploy Backend / Notify Deployment Status (push) Successful in 2s
Build and Deploy Frontend Learner / Notify Deployment Status (push) Successful in 2s
feat: Implement local backend development setup with Docker Compose, introduce .dockerignore, and remove dev dependency pruning from the Dockerfile.
2026-02-10 14:26:09 +07:00

129 lines
2.9 KiB
YAML

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