bun install → bun run build → bun run compilesocial/api-prod (production) / social/api-base-prod (base)drizzle/)build/api/Social/api/
├─ build/
│ ├─ Dockerfile-base # Base image: Supervisor + Nginx
│ ├─ Dockerfile # Production: Bun build → binary
│ ├─ api/ # ⚡ Git submodule — Bun source
│ │ ├─ .env
│ │ ├─ package.json
│ │ ├─ bun.lock
│ │ ├─ drizzle/ # Drizzle ORM migrations
│ │ └─ src/
│ └─ conf/
│ ├─ nginx/
│ │ ├─ common/nginx.conf # Cấu hình Nginx chung
│ │ └─ template/default.conf.template # Template server block
│ └─ supervisor/
│ ├─ common/supervisord.conf # Cấu hình Supervisor chung
│ ├─ common/entry_point.sh # Script khởi chạy
│ ├─ nginx.conf # Cấu hình Nginx Supervisor
│ ├─ social-api.conf # Cấu hình API Supervisor
│ └─ *.sh # Các script khởi chạy
├─ .env.production # Biến môi trường Docker Compose
└─ docker-compose.yml.production # Compose file┌──────────────────────────────────────────────────────────────┐
│ BUN BUILD PIPELINE │
│ │
│ ┌─────────────┐ ┌──────────────┐ │
│ │ GIAI ĐOẠN 1 │ │ GIAI ĐOẠN 2 │ │
│ │ build │───────────▶│ production │ │
│ │ │ │ │ │
│ │ • bun │ │ • Base image │ │
│ │ install │ │ • Supervisor │ │
│ │ • bun run │ │ • Nginx │ │
│ │ build │ │ • Bun binary │ │
│ │ • bun run │ │ • Drizzle │ │
│ │ compile │ │ migrations │ │
│ └─────────────┘ └──────────────┘ │
└──────────────────────────────────────────────────────────────┘| Dịch Vụ | Image | Port | Mục Đích |
|---|---|---|---|
| NATS | nats:alpine | 4222 | Hàng đợi tin nhắn cho giao tiếp bất đồng bộ |
| Công Cụ | Phiên Bản Tối Thiểu | Mục Đích |
|---|---|---|
| Docker | ≥ 24.0.0 | Quản lý container |
| MongoDB | ≥ 7 | Máy chủ cơ sở dữ liệu |
| MySQL | ≥ 8 | Máy chủ cơ sở dữ liệu |
.env.production)build/api/.env)Lưu ý: Dịch vụ API triển khai cùng container NATS cho hàng đợi tin nhắn. File .envcủa ứng dụng Bun được mount read-only tại/app/.env.
.env không bao giờ nhúng vào image — mount dưới dạng read-only volume khi runtime