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