|
@@ -1,7 +1,42 @@
|
|
|
-version: '3'
|
|
|
+# version: '3'
|
|
|
+
|
|
|
+# services:
|
|
|
+# nextjs:
|
|
|
+# build:
|
|
|
+# context: .
|
|
|
+# dockerfile: Dockerfile.prod
|
|
|
+# args:
|
|
|
+# - MONGODB_URI=mongodb://mongodb:27017/mydatabase
|
|
|
+# ports:
|
|
|
+# - "3000:3000"
|
|
|
+# environment:
|
|
|
+# - NODE_ENV=production
|
|
|
+# - MONGODB_URI=mongodb://mongodb:27017/mydatabase
|
|
|
+# depends_on:
|
|
|
+# - mongodb
|
|
|
+
|
|
|
+# mongodb:
|
|
|
+# image: mongo
|
|
|
+# volumes:
|
|
|
+# - mongodb_data:/data/db
|
|
|
+
|
|
|
+# nginx:
|
|
|
+# image: nginx:alpine
|
|
|
+# ports:
|
|
|
+# - "8088:80"
|
|
|
+# volumes:
|
|
|
+# - ./nginx:/etc/nginx/conf.d
|
|
|
+# - ./logs/nginx:/var/log/nginx
|
|
|
+
|
|
|
+# depends_on:
|
|
|
+# - nextjs
|
|
|
+
|
|
|
+# volumes:
|
|
|
+# mongodb_data:
|
|
|
|
|
|
services:
|
|
|
nextjs:
|
|
|
+ container_name: match-vote-nextjs-nextjs-1
|
|
|
build:
|
|
|
context: .
|
|
|
dockerfile: Dockerfile.prod
|
|
@@ -14,11 +49,13 @@ services:
|
|
|
- MONGODB_URI=mongodb://mongodb:27017/mydatabase
|
|
|
depends_on:
|
|
|
- mongodb
|
|
|
+ restart: unless-stopped # 添加自动重启策略
|
|
|
|
|
|
mongodb:
|
|
|
image: mongo
|
|
|
volumes:
|
|
|
- mongodb_data:/data/db
|
|
|
+ restart: unless-stopped # 添加自动重启策略
|
|
|
|
|
|
nginx:
|
|
|
image: nginx:alpine
|
|
@@ -27,9 +64,14 @@ services:
|
|
|
volumes:
|
|
|
- ./nginx:/etc/nginx/conf.d
|
|
|
- ./logs/nginx:/var/log/nginx
|
|
|
-
|
|
|
depends_on:
|
|
|
- nextjs
|
|
|
+ restart: unless-stopped # 添加自动重启策略
|
|
|
|
|
|
volumes:
|
|
|
mongodb_data:
|
|
|
+
|
|
|
+networks:
|
|
|
+ default:
|
|
|
+ name: match-vote-network # 为网络指定一个名称
|
|
|
+
|