部署:在 docker-compose 中加入 mongo 服务并示例 .env

This commit is contained in:
2025-08-23 17:29:01 +08:00
parent f43aa5e35f
commit 266c55c7b7
2 changed files with 21 additions and 0 deletions

6
.env.example Normal file
View File

@@ -0,0 +1,6 @@
# Copy to .env and fill values
MONGO_URI=mongodb://mongo:27017/chatdb
JWT_SECRET=change_this_to_a_random_secret
PORT=4000
OPENAI_API_KEY=
OTHER_PROVIDER_KEY=

View File

@@ -7,8 +7,12 @@ services:
ports:
- "4000:4000"
restart: always
env_file:
- ../.env
environment:
- NODE_ENV=production
depends_on:
- mongo
frontend:
build:
@@ -19,3 +23,14 @@ services:
restart: always
depends_on:
- backend
mongo:
image: mongo:6
restart: unless-stopped
volumes:
- mongo-data:/data/db
ports:
- "27017:27017"
volumes:
mongo-data: