Files
zhuangxiu/docker-compose.yml

66 lines
1.5 KiB
YAML

name: zhuangxiu
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7.4-alpine
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes", "--requirepass", "${REDIS_PASSWORD}"]
volumes:
- redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5
api:
build:
context: ./services/api
restart: unless-stopped
env_file:
- .env
ports:
- "${API_PORT:-8000}:8000"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- settings-data:/app/.runtime
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
web:
build:
context: ./apps/web
args:
NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL}
restart: unless-stopped
environment:
NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL}
ports:
- "3000:3000"
depends_on:
- api
volumes:
postgres-data:
redis-data:
settings-data: