docker-compose.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. version: '3'
  2. networks:
  3. kphcdr:
  4. driver: bridge
  5. services:
  6. nginx:
  7. container_name: ${ABBREVIATION}-nginx
  8. image: docker.io/nginx:1.23.0
  9. restart: always
  10. depends_on:
  11. - "php"
  12. volumes:
  13. - ./www:/www
  14. - ./config/nginx/conf.d:/etc/nginx/conf.d
  15. - ./logs/nginx/logs:/logs
  16. networks:
  17. - kphcdr
  18. ports:
  19. - "${NUMBER}080:80"
  20. php:
  21. #没有自定义要求就用镜像
  22. #build:
  23. # context: ./config/php
  24. # args:
  25. # TZ: "Asia/Shanghai"
  26. image: docker.io/kphcdr/kphcdr_php:latest
  27. restart: always
  28. container_name: ${ABBREVIATION}-php-fpm
  29. working_dir: /www/server
  30. volumes:
  31. - ./www:/www
  32. - ./config/php/php.ini:/usr/local/etc/php/php.ini
  33. networks:
  34. - kphcdr
  35. mysql:
  36. container_name: ${ABBREVIATION}-mysql
  37. image: docker.io/mysql:5.7.29 #X86架构
  38. restart: always
  39. platform: linux/amd64 #osx系统才需要
  40. ports:
  41. - "${NUMBER}3306:3306"
  42. volumes:
  43. - ./data/mysql5.7.29/lib:/var/lib/mysql
  44. - ./config/mysql/mysqld.cnf:/etc/mysql/my.cnf
  45. environment:
  46. MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
  47. TZ: "Asia/Shanghai"
  48. networks:
  49. - kphcdr
  50. redis:
  51. container_name: ${ABBREVIATION}-redis
  52. image: docker.io/redis:6.2.7
  53. restart: always
  54. volumes:
  55. - ./data/redis:/data
  56. networks:
  57. - kphcdr
  58. ports:
  59. - "${NUMBER}6379:6379"