docker-compose.prod.yml 1019 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. services:
  2. nextjs:
  3. container_name: match-vote-nextjs-nextjs-1
  4. build:
  5. context: .
  6. dockerfile: Dockerfile.prod
  7. args:
  8. - MONGODB_URI=mongodb://mongodb:27017/mydatabase
  9. ports:
  10. - "3000:3000"
  11. environment:
  12. - NODE_ENV=production
  13. - MONGODB_URI=mongodb://mongodb:27017/mydatabase
  14. depends_on:
  15. - mongodb
  16. restart: unless-stopped # 添加自动重启策略
  17. volumes:
  18. - /www/wwwroot/match-vote-nextjs/app/public/uploads:/app/public/uploads # 添加这行来挂载 uploads volume
  19. mongodb:
  20. image: mongo
  21. volumes:
  22. - mongodb_data:/data/db
  23. restart: unless-stopped # 添加自动重启策略
  24. nginx:
  25. image: nginx:alpine
  26. ports:
  27. - "8088:80"
  28. volumes:
  29. - ./nginx:/etc/nginx/conf.d
  30. - ./logs/nginx:/var/log/nginx
  31. depends_on:
  32. - nextjs
  33. restart: unless-stopped # 添加自动重启策略
  34. volumes:
  35. mongodb_data:
  36. networks:
  37. default:
  38. name: match-vote-network # 为网络指定一个名称