Files
template_001/docker-compose.yml

70 lines
1.5 KiB
YAML

services:
app:
build:
context: .
args:
SOURCE_COMMIT: ${SOURCE_COMMIT:-unknown}
APP_VERSION: ${APP_VERSION:-1.0.0}
restart: unless-stopped
environment:
- NODE_ENV=production
- PORT=3000
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
- REDIS_HOST=redis
- REDIS_PORT=6379
- APP_VERSION=${APP_VERSION:-1.0.0}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
expose:
- "3000"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 10s
timeout: 3s
start_period: 5s
retries: 2
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
volumes:
- postgres-data:/var/lib/postgresql/data
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 3
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis-data:/data
expose:
- "6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 3
volumes:
postgres-data:
driver: local
redis-data:
driver: local