92 lines
2.7 KiB
YAML
92 lines
2.7 KiB
YAML
name: next-chair
|
|
|
|
# Local Docker Desktop deployment — production-style by default (real
|
|
# migrations, no auto-seed), not a dev-mode source-mount setup. See the
|
|
# README section this file is documented under for exact commands.
|
|
#
|
|
# Config source of truth: copy .env.local.example to .env.local and run
|
|
# every command below with `--env-file .env.local` (see README) — that
|
|
# one file drives both container environment variables (via each
|
|
# service's `env_file:`) and the few values this compose file itself
|
|
# needs (the host-port mappings below).
|
|
|
|
services:
|
|
next-chair-mysql:
|
|
image: mysql:8.0
|
|
container_name: next-chair-mysql
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env.local
|
|
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_ai_ci
|
|
ports:
|
|
- "${MYSQL_HOST_PORT:-3306}:3306"
|
|
volumes:
|
|
- next-chair-mysql-data:/var/lib/mysql
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-change-me-too}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 20
|
|
start_period: 10s
|
|
networks:
|
|
- next-chair
|
|
|
|
next-chair:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: next-chair
|
|
restart: unless-stopped
|
|
depends_on:
|
|
next-chair-mysql:
|
|
condition: service_healthy
|
|
env_file:
|
|
- .env.local
|
|
ports:
|
|
- "${APP_HOST_PORT:-3000}:3000"
|
|
healthcheck:
|
|
# No curl/wget in the node:22-alpine base image — a plain Node
|
|
# request avoids adding a package just for this. See
|
|
# src/app/api/health/route.ts: healthy as soon as the database is
|
|
# reachable, even before installation completes.
|
|
test:
|
|
[
|
|
"CMD",
|
|
"node",
|
|
"-e",
|
|
"require('http').get('http://localhost:3000/api/health', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))",
|
|
]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 20s
|
|
networks:
|
|
- next-chair
|
|
|
|
# Explicit, opt-in only — never runs as part of a normal `up` (see the
|
|
# `profiles` key). Development/demo fixtures, not a production seed —
|
|
# see prisma/seed.ts's own header and docs/phase-8-summary.md,
|
|
# "Production installation versus development seed."
|
|
next-chair-seed:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: next-chair-seed
|
|
profiles: ["seed"]
|
|
depends_on:
|
|
next-chair-mysql:
|
|
condition: service_healthy
|
|
env_file:
|
|
- .env.local
|
|
entrypoint: ["npx", "tsx", "prisma/seed.ts"]
|
|
networks:
|
|
- next-chair
|
|
|
|
volumes:
|
|
next-chair-mysql-data:
|
|
name: next-chair-mysql-data
|
|
|
|
networks:
|
|
next-chair:
|
|
name: next-chair
|