Files
zerp/docker-compose.yml
2026-03-30 11:45:44 +04:00

70 lines
2.0 KiB
YAML

version: '3.8'
services:
postgres:
image: postgres:16-alpine
container_name: zerp_postgres
restart: unless-stopped
environment:
POSTGRES_DB: mind14_crm
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres123}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: zerp_backend
restart: always
environment:
PORT: 5001
NODE_ENV: production
# Default matches postgres service when POSTGRES_PASSWORD is unset (local/staging).
# Override via `.env` (Compose loads `.env`, not `.env.production`).
DATABASE_URL: ${DATABASE_URL:-postgresql://postgres:${POSTGRES_PASSWORD:-postgres123}@postgres:5432/mind14_crm?schema=public}
JWT_SECRET: ${JWT_SECRET:-z-crm-jwt-secret-change-in-production-NOW}
JWT_EXPIRES_IN: 7d
JWT_REFRESH_EXPIRES_IN: 30d
BCRYPT_ROUNDS: 10
CORS_ORIGIN: https://zerp.atmata-group.com,http://zerp.atmata-group.com,http://localhost:3000,http://37.60.249.71:3000
depends_on:
postgres:
condition: service_healthy
ports:
- "5001:5001"
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:5001/api/v1/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
command: sh -c "npx prisma migrate deploy && node dist/server.js"
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
NEXT_PUBLIC_API_URL: https://zerp.atmata-group.com/api/v1
container_name: zerp_frontend
restart: unless-stopped
environment:
NEXT_PUBLIC_API_URL: https://zerp.atmata-group.com/api/v1
depends_on:
- backend
ports:
- "3000:3000"
volumes:
postgres_data:
driver: local