109 lines
2.4 KiB
YAML
109 lines
2.4 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: retail-pos-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: retail_pos
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
networks:
|
|
- retail-pos-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# 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 Application
|
|
api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: retail-pos-api
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
NODE_ENV: production
|
|
PORT: 3000
|
|
API_PREFIX: api
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_USERNAME: postgres
|
|
DB_PASSWORD: postgres
|
|
DB_DATABASE: retail_pos
|
|
JWT_SECRET: retail-pos-super-secret-key-change-in-production-2025
|
|
JWT_EXPIRES_IN: 1d
|
|
REDIS_HOST: redis
|
|
REDIS_PORT: 6379
|
|
CACHE_TTL: 300
|
|
CORS_ORIGIN: http://localhost:3000,capacitor://localhost
|
|
THROTTLE_TTL: 60
|
|
THROTTLE_LIMIT: 100
|
|
BCRYPT_ROUNDS: 10
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- retail-pos-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Optional: pgAdmin for database management
|
|
pgadmin:
|
|
image: dpage/pgadmin4:latest
|
|
container_name: retail-pos-pgadmin
|
|
restart: unless-stopped
|
|
environment:
|
|
PGADMIN_DEFAULT_EMAIL: admin@retailpos.com
|
|
PGADMIN_DEFAULT_PASSWORD: admin123
|
|
ports:
|
|
- "5050:80"
|
|
depends_on:
|
|
- postgres
|
|
networks:
|
|
- retail-pos-network
|
|
profiles:
|
|
- tools
|
|
|
|
volumes:
|
|
postgres-data:
|
|
driver: local
|
|
redis-data:
|
|
driver: local
|
|
|
|
networks:
|
|
retail-pos-network:
|
|
driver: bridge
|