Files
korrithwebsite/docker-compose.yml

82 lines
2.3 KiB
YAML

# Korrith — production stack for Coolify / plain Docker Compose.
#
# Expose the `web` service (container port 80) with your domain.
# It serves the built frontend and reverse-proxies same-origin paths:
# /hcgi/api/* -> api:3001 (Express)
# /hcgi/platform/* -> pocketbase:8090 (PocketBase API + admin UI at /hcgi/platform/_/)
#
# Required environment variables are documented in .env.example.
services:
pocketbase:
build:
context: ./apps/pocketbase
restart: unless-stopped
environment:
PB_ENCRYPTION_KEY: ${PB_ENCRYPTION_KEY:-change-me-32-plus-random-chars}
PB_SUPERUSER_EMAIL: ${PB_SUPERUSER_EMAIL:-admin@example.com}
PB_SUPERUSER_PASSWORD: ${PB_SUPERUSER_PASSWORD:-change-me-strong-password}
volumes:
- pocketbase-data:/pb_data
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:8090/api/health"]
interval: 10s
timeout: 5s
retries: 20
start_period: 30s
api:
build:
context: .
dockerfile: apps/api/Dockerfile
restart: unless-stopped
environment:
PORT: 3001
CORS_ORIGIN: ${CORS_ORIGIN:-*}
PB_SUPERUSER_EMAIL: ${PB_SUPERUSER_EMAIL}
PB_SUPERUSER_PASSWORD: ${PB_SUPERUSER_PASSWORD}
SMTP_HOST: ${SMTP_HOST:?Set SMTP_HOST}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER:?Set SMTP_USER}
SMTP_PASSWORD: ${SMTP_PASSWORD:?Set SMTP_PASSWORD}
MAIL_FROM: ${MAIL_FROM:-}
MAIL_REPLY_TO: ${MAIL_REPLY_TO:-}
ADMIN_EMAILS: ${ADMIN_EMAILS:-}
depends_on:
pocketbase:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://localhost:3001/health-check').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 15s
timeout: 5s
retries: 10
start_period: 20s
web:
build:
context: .
dockerfile: apps/web/Dockerfile
restart: unless-stopped
ports:
- "80" # Coolify: point your domain at this service, container port 80
depends_on:
api:
condition: service_healthy
pocketbase:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost/"]
interval: 15s
timeout: 5s
retries: 10
start_period: 10s
volumes:
pocketbase-data: