Files
airi/server/docker-compose.yml

64 lines
1.6 KiB
YAML

name: proj-airi-api
services:
db:
image: ghcr.io/tensorchord/vchord-postgres:pg18-v1.0.0
environment:
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=example-PAssw0rd-xHjDYR.b7N
ports:
- '5435:5432'
volumes:
- ./apps/api/sql/init.sql:/docker-entrypoint-initdb.d/init.sql
- db_data:/var/lib/postgresql
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB']
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
ports:
- '6379:6379'
volumes:
- redis_data:/data
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 5s
timeout: 5s
retries: 10
api:
build:
context: ..
dockerfile: server/apps/api/Dockerfile
command: ['pnpm', '-F', '@proj-airi/api-server', 'run', 'server', 'api']
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
env_file:
- path: ./apps/api/.env
required: false
- path: ./apps/api/.env.local
required: false
environment:
DATABASE_URL: postgresql://postgres:example-PAssw0rd-xHjDYR.b7N@db:5432/postgres
REDIS_URL: redis://redis:6379
ports:
- '6112:3000'
healthcheck:
test: ['CMD', 'node', '-e', "fetch('http://localhost:3000/livez').then(response => process.exit(response.ok ? 0 : 1)).catch(() => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 5
volumes:
db_data:
driver: local
redis_data:
driver: local