docker-compose.prod.yml 888 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. mongodb:
  18. image: mongo
  19. volumes:
  20. - mongodb_data:/data/db
  21. restart: unless-stopped # 添加自动重启策略
  22. nginx:
  23. image: nginx:alpine
  24. ports:
  25. - "8088:80"
  26. volumes:
  27. - ./nginx:/etc/nginx/conf.d
  28. - ./logs/nginx:/var/log/nginx
  29. depends_on:
  30. - nextjs
  31. restart: unless-stopped # 添加自动重启策略
  32. volumes:
  33. mongodb_data:
  34. networks:
  35. default:
  36. name: match-vote-network # 为网络指定一个名称