chore: initialize Next.js + FastAPI monorepo with Docker Compose

This commit is contained in:
chengkai3
2026-04-11 23:28:23 +08:00
commit add7517a1d
36 changed files with 7308 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
services:
api:
build:
context: ./api
dockerfile: Dockerfile
container_name: fquiz-api
environment:
API_HOST: ${API_HOST:-0.0.0.0}
API_PORT: ${API_PORT:-8000}
API_CORS_ORIGINS: ${API_CORS_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000}
ports:
- "${API_PORT:-8000}:8000"
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2).read()",
]
interval: 10s
timeout: 3s
retries: 5
start_period: 10s
restart: unless-stopped
web:
build:
context: ./web
dockerfile: Dockerfile
args:
NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL:-http://localhost:8000}
container_name: fquiz-web
depends_on:
api:
condition: service_healthy
environment:
NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL:-http://localhost:8000}
NODE_ENV: production
ports:
- "3000:3000"
restart: unless-stopped