docker-compose.prod.yml 1018 B

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