feat(deploy): 添加 docker-compose 一键部署配置
定义 backend 和 frontend 两个服务: - backend 监听 3001 端口,设置 Prisma OpenSSL 3.x 环境变量, JWT_SECRET 通过宿主机环境变量注入避免硬编码 - frontend 监听 8080 端口,depends_on backend 保证启动顺序 使用方式: JWT_SECRET=your-secret docker-compose up -d
This commit is contained in:
parent
92071e5ba6
commit
0b3998489d
28
docker-compose.yml
Normal file
28
docker-compose.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: ./reading-platform-backend
|
||||||
|
container_name: kindergarten-backend
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "3001:3001"
|
||||||
|
environment:
|
||||||
|
- PORT=3001
|
||||||
|
- NODE_ENV=production
|
||||||
|
- DATABASE_URL=file:/app/prisma/dev.db
|
||||||
|
- JWT_SECRET=${JWT_SECRET:-change-this-secret}
|
||||||
|
- JWT_EXPIRES_IN=7d
|
||||||
|
- FRONTEND_URL=http://localhost:8080
|
||||||
|
- PRISMA_QUERY_ENGINE_LIBRARY=/app/node_modules/.prisma/client/libquery_engine-linux-musl-openssl-3.0.x.so.node
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ./reading-platform-frontend
|
||||||
|
container_name: kindergarten-frontend
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
Loading…
Reference in New Issue
Block a user