lila/docker-compose.yml
lila 2ebf0d0a83 infra: add Docker Compose setup for local development
- Configure PostgreSQL 18 and Valkey 9.1 services
- Create multi-stage Dockerfiles for API and Web apps
- Set up pnpm workspace support in container builds
- Configure hot reload via volume mounts for both services
- Add healthchecks for service orchestration
- Support dev/production stage targets (tsx watch vs compiled)
2026-03-25 18:56:04 +01:00

76 lines
1.8 KiB
YAML

services:
database:
container_name: glossa-database
image: postgres:18.3-alpine3.23
env_file:
- .env
ports:
- "5432:5432"
volumes:
- glossa-db:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
valkey:
container_name: glossa-valkey
image: valkey/valkey:9.1-alpine3.23
ports:
- "6379:6379"
restart: unless-stopped
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
api:
container_name: glossa-api
build:
context: .
dockerfile: ./apps/api/Dockerfile
target: dev
env_file:
- .env
ports:
- "3000:3000"
volumes:
- ./apps/api:/app/apps/api # Hot reload API code
- ./packages/shared:/app/packages/shared # Hot reload shared
- /app/node_modules
restart: unless-stopped
healthcheck:
test:
["CMD-SHELL", "wget -qO- http://localhost:3000/api/health || exit 1"]
interval: 5s
timeout: 3s
retries: 5
depends_on:
database:
condition: service_healthy
valkey:
condition: service_healthy
web:
container_name: glossa-web
build:
context: .
dockerfile: ./apps/web/Dockerfile
target: dev
ports:
- "5173:5173"
volumes:
- ./apps/web:/app/apps/web # Hot reload: local edits reflect immediately
- /app/node_modules # Protect container's node_modules from being overwritten
environment:
- VITE_API_URL=http://localhost:3000
restart: unless-stopped
depends_on:
api:
condition: service_healthy
volumes:
glossa-db: