Files
retail-nest/docker-compose.yml
Phuoc Nguyen 8c34460889 update docker
2025-10-10 17:13:45 +07:00

82 lines
1.7 KiB
YAML

version: '3.8'
services:
# Redis Cache
redis:
image: redis:7-alpine
container_name: retail-pos-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- retail-pos-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# NestJS API Application
api:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: retail-pos-api
restart: unless-stopped
ports:
- "3000:3000"
environment:
# Application
NODE_ENV: production
PORT: 3000
API_PREFIX: api
# Database (Aiven PostgreSQL)
DB_HOST: pg-30ed1d6a-renolation.b.aivencloud.com
DB_PORT: 20912
DB_USERNAME: avnadmin
DB_PASSWORD: AVNS_b5AVrZdm2M2donLgXXQ
DB_DATABASE: defaultdb
DB_SSL: "true"
# JWT Configuration
JWT_SECRET: retail-pos-super-secret-key-change-in-production-2025
JWT_EXPIRES_IN: 1d
# Redis Cache
REDIS_HOST: redis
REDIS_PORT: 6379
CACHE_TTL: 300
# CORS
CORS_ORIGIN: http://localhost:3000,capacitor://localhost
# Rate Limiting
THROTTLE_TTL: 60
THROTTLE_LIMIT: 100
# Bcrypt
BCRYPT_ROUNDS: 10
depends_on:
redis:
condition: service_healthy
networks:
- retail-pos-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
redis-data:
driver: local
networks:
retail-pos-network:
driver: bridge