|
@@ -0,0 +1,49 @@
|
|
|
+services:
|
|
|
+ nextjs:
|
|
|
+ # container_name: match-vote-nextjs-nextjs-1
|
|
|
+ build:
|
|
|
+ context: .
|
|
|
+ dockerfile: Dockerfile.prod
|
|
|
+ args:
|
|
|
+ - MONGODB_URI=mongodb://mongodb:27017/lvyin_db
|
|
|
+ ports:
|
|
|
+ - "3000:3000"
|
|
|
+ environment:
|
|
|
+ - NODE_ENV=production
|
|
|
+ - MONGODB_URI=mongodb://mongodb:27017/lvyin_db
|
|
|
+ depends_on:
|
|
|
+ - mongodb
|
|
|
+ restart: unless-stopped # 添加自动重启策略
|
|
|
+ volumes:
|
|
|
+ - uploads_data:/app/public/uploads
|
|
|
+
|
|
|
+ mongodb:
|
|
|
+ image: mongo
|
|
|
+ volumes:
|
|
|
+ - mongodb_data:/data/db
|
|
|
+ restart: unless-stopped # 添加自动重启策略
|
|
|
+
|
|
|
+ nginx:
|
|
|
+ # container_name: match-vote-nextjs-nginx-1
|
|
|
+ image: nginx:alpine
|
|
|
+ ports:
|
|
|
+ - "8081:80"
|
|
|
+
|
|
|
+ volumes:
|
|
|
+ - ./nginx:/etc/nginx/conf.d
|
|
|
+ - ./logs/nginx:/var/log/nginx
|
|
|
+ - uploads_data:/app/public/uploads:ro
|
|
|
+ - ./certs:/etc/nginx/certs
|
|
|
+
|
|
|
+ depends_on:
|
|
|
+ - nextjs
|
|
|
+ restart: unless-stopped # 添加自动重启策略
|
|
|
+
|
|
|
+volumes:
|
|
|
+ mongodb_data:
|
|
|
+ uploads_data:
|
|
|
+
|
|
|
+networks:
|
|
|
+ default:
|
|
|
+ # name: match-vote-network # 为网络指定一个名称
|
|
|
+
|