38 lines
1.0 KiB
YAML
38 lines
1.0 KiB
YAML
services:
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: huishou-backend
|
|
ports:
|
|
- "4000:4000" # 后端服务映射到宿主机 4000 端口
|
|
volumes:
|
|
- ./server/data:/app/server/data
|
|
- ./server/icons:/app/server/icons
|
|
environment:
|
|
- NODE_ENV=production
|
|
- PORT=4000
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "node", "-e", "require('http').get('http://localhost:4000/api/prices', (r) => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
nginx:
|
|
image: nginx:latest
|
|
container_name: huishou
|
|
ports:
|
|
- "80:80" # Web 前端映射到宿主机 80 端口
|
|
volumes:
|
|
- ./admin:/usr/share/nginx/html/admin
|
|
- ./dist/build/h5:/usr/share/nginx/html/h5
|
|
- ./admin/nginx.conf:/etc/nginx/conf.d/default.conf
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
default:
|
|
driver: bridge |