Files
AI-Bill/docker-compose.yml

52 lines
1.5 KiB
YAML
Raw Permalink Normal View History

2025-11-01 09:24:26 +08:00
services:
mongo:
image: mongo:7.0.14
platform: linux/amd64
container_name: ai-bill-mongo
restart: unless-stopped
ports:
2025-11-11 17:49:41 +08:00
- "27018:27017"
2025-11-10 13:58:06 +08:00
environment:
MONGO_INITDB_DATABASE: ai-bill
2025-11-01 09:24:26 +08:00
volumes:
- mongo-data:/data/db
2025-11-13 15:27:23 +08:00
healthcheck:
test: ["CMD-SHELL", "mongosh --quiet --eval 'db.runCommand({ ping: 1 }).ok' | grep 1"]
interval: 10s
timeout: 5s
retries: 10
2025-11-10 13:58:06 +08:00
backend:
build:
context: .
dockerfile: Dockerfile
2025-11-13 15:27:23 +08:00
args:
# 可根据网络情况切换为国内镜像源
NPM_REGISTRY: ${NPM_REGISTRY:-https://registry.npmjs.org/}
2025-11-10 13:58:06 +08:00
container_name: ai-bill-backend
depends_on:
2025-11-13 15:27:23 +08:00
mongo:
condition: service_healthy
2025-11-10 13:58:06 +08:00
environment:
NODE_ENV: production
HOST: 0.0.0.0
PORT: 4000
MONGODB_URI: mongodb://mongo:27017/ai-bill
MONGODB_DB: ai-bill
2025-11-12 16:19:09 +08:00
JWT_SECRET: 100b20ee88da3f6a79b539d3a488a327a4159093c3142e5c918910b9adcb52d0
JWT_REFRESH_SECRET: d2cf95a42f08796a306b5c0e1ce57dabcab12300eea504296da3381e125e9c8a
NOTIFICATION_WEBHOOK_SECRET: bf921ce9ac433ba2fdfccbccb50e7d805ac89f166962e4b8437a3ecd4ef833b2
2025-11-10 13:58:06 +08:00
ports:
2025-11-12 16:22:57 +08:00
- "4010:4000"
2025-11-10 13:58:06 +08:00
restart: unless-stopped
2025-11-13 15:27:23 +08:00
stop_signal: SIGTERM
stop_grace_period: 20s
2025-11-10 13:58:06 +08:00
healthcheck:
2025-11-13 15:27:23 +08:00
test: ["CMD", "node", "-e", "fetch('http://localhost:4000/api/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
2025-11-10 13:58:06 +08:00
interval: 30s
timeout: 5s
retries: 5
2025-11-01 09:24:26 +08:00
volumes:
mongo-data:
driver: local