chore: deploy with Docker Compose on Dokploy
Add the two runtime images and their compose file: `api` (Bun bundle, runs `prisma migrate deploy` before `bun run start`) and `web` (Vite build served by nginx, which proxies `/api/*` to the API and keeps the SSE streams unbuffered with a long read timeout). The database is external and both services join the `dokploy-network` for Traefik. Remove the GitHub Actions workflow: there is no hosted CI, so the verification scripts run locally.
This commit is contained in:
65
docker-compose.yml
Normal file
65
docker-compose.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
# Dokploy deployment: the API and the static frontend behind nginx.
|
||||
# The database is external (Dokploy's), and the containers join the shared
|
||||
# `dokploy-network` so Dokploy's Traefik can reach them via the Domains UI.
|
||||
services:
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/api/Dockerfile
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# Required: no sensible default for any of these.
|
||||
DATABASE_URL: ${DATABASE_URL:?Set DATABASE_URL in the Dokploy env}
|
||||
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET:?Set BETTER_AUTH_SECRET in the Dokploy env}
|
||||
BETTER_AUTH_URL: ${BETTER_AUTH_URL:?Set BETTER_AUTH_URL in the Dokploy env}
|
||||
CORS_ORIGIN: ${CORS_ORIGIN:?Set CORS_ORIGIN in the Dokploy env}
|
||||
WEB_APP_URL: ${WEB_APP_URL:?Set WEB_APP_URL in the Dokploy env}
|
||||
# Optional: sensible defaults when unset.
|
||||
NODE_ENV: ${NODE_ENV:-production}
|
||||
PORT: ${PORT:-4100}
|
||||
LOG_LEVEL: ${LOG_LEVEL:-}
|
||||
RESEND_API_KEY: ${RESEND_API_KEY:-}
|
||||
MAIL_FROM: ${MAIL_FROM:-}
|
||||
expose:
|
||||
- "4100"
|
||||
networks:
|
||||
- dokploy-network
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD",
|
||||
"bun",
|
||||
"-e",
|
||||
"fetch(`http://localhost:${PORT:-4100}/api/health`).then((r) => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))",
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apps/web/Dockerfile
|
||||
args:
|
||||
# Empty = same origin (nginx proxies /api/*). Only set this if the
|
||||
# frontend must call the API on a different origin.
|
||||
VITE_API_URL: ${VITE_API_URL:-}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
expose:
|
||||
- "80"
|
||||
networks:
|
||||
- dokploy-network
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO", "/dev/null", "http://127.0.0.1/"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
networks:
|
||||
dokploy-network:
|
||||
external: true
|
||||
Reference in New Issue
Block a user