45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
# docker-compose.prod.yml (Cho Production / CI/CD)
|
|
version: '3.8'
|
|
|
|
services:
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile # Sử dụng Dockerfile production
|
|
container_name: ulflow-api-prod
|
|
ports:
|
|
- "3000:3000"
|
|
# KHÔNG CÓ VOLUMES: - .:/app ở đây!
|
|
command: /app/app # Chạy binary đã build
|
|
# KHÔNG CÓ ENV_FILE Ở ĐÂY, BIẾN MÔI TRƯỜNG SẼ ĐƯỢC CUNG CẤP TỪ BÊN NGOÀI
|
|
restart: always
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.50'
|
|
memory: 256M
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- ulflow-network
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: ulflow-postgres-prod
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${DATABASE_USERNAME}
|
|
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
|
|
POSTGRES_DB: ${DATABASE_NAME}
|
|
ports:
|
|
- "5433:5432"
|
|
volumes:
|
|
- postgres-prod-data:/var/lib/postgresql/data # Volume riêng cho prod DB
|
|
networks:
|
|
- ulflow-network
|
|
volumes:
|
|
postgres-prod-data:
|
|
|
|
networks:
|
|
ulflow-network:
|
|
driver: bridge |