43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
|
|
version: '3.8'
|
||
|
|
|
||
|
|
services:
|
||
|
|
# 前端 Nginx 服务(使用 8080 端口避免与现有 nginx 冲突)
|
||
|
|
nginx:
|
||
|
|
image: nginx:alpine
|
||
|
|
container_name: ai-learning-nginx
|
||
|
|
ports:
|
||
|
|
- "8080:80" # 使用 8080 端口,避免与现有 nginx 冲突
|
||
|
|
- "8443:443" # HTTPS 端口(可选)
|
||
|
|
volumes:
|
||
|
|
- /opt/nginx/html/ai/current/docker/nginx.conf.docker:/etc/nginx/conf.d/default.conf:ro
|
||
|
|
- /opt/nginx/html/ai/current:/usr/share/nginx/html:ro
|
||
|
|
- /opt/nginx/html/ai/current/docker/logs:/var/log/nginx
|
||
|
|
depends_on:
|
||
|
|
- backend
|
||
|
|
restart: unless-stopped
|
||
|
|
networks:
|
||
|
|
- ai-learning-network
|
||
|
|
|
||
|
|
# 后端服务
|
||
|
|
backend:
|
||
|
|
build:
|
||
|
|
context: /opt/nginx/html/ai/current/backend
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
container_name: ai-learning-backend
|
||
|
|
ports:
|
||
|
|
- "3001:3001"
|
||
|
|
environment:
|
||
|
|
- NODE_ENV=production
|
||
|
|
- PORT=3001
|
||
|
|
- DATABASE_URL=file:./prisma/dev.db
|
||
|
|
volumes:
|
||
|
|
- /opt/nginx/html/ai/current/backend/prisma:/app/prisma
|
||
|
|
- /opt/nginx/html/ai/current/backend/dist:/app/dist:ro
|
||
|
|
restart: unless-stopped
|
||
|
|
networks:
|
||
|
|
- ai-learning-network
|
||
|
|
|
||
|
|
networks:
|
||
|
|
ai-learning-network:
|
||
|
|
driver: bridge
|