docker-compose.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. - ./log/nginx/logs:/logs
  16. networks:
  17. - kphcdr
  18. ports:
  19. - "${NUMBER}080:80"
  20. php:
  21. build:
  22. context: ./config/php
  23. args:
  24. PHP_VERSION: php:8.0-fpm
  25. TZ: "Asia/Shanghai"
  26. restart: always
  27. container_name: ${ABBREVIATION}-php-fpm
  28. working_dir: /www/server
  29. volumes:
  30. - ./www:/www
  31. - ./config/php/php.ini:/usr/local/etc/php/php.ini
  32. networks:
  33. - kphcdr
  34. mysql:
  35. container_name: ${ABBREVIATION}-mysql
  36. image: docker.io/mysql:5.7.29 #X86架构
  37. restart: always
  38. platform: linux/amd64 #osx系统才需要
  39. ports:
  40. - "${NUMBER}3306:3306"
  41. volumes:
  42. - ./data/mysql5.7.29/lib:/var/lib/mysql
  43. - ./config/mysql/mysqld.cnf:/etc/mysql/my.cnf
  44. environment:
  45. MYSQL_ROOT_PASSWORD: ${MYSQL_PASSWORD}
  46. TZ: "Asia/Shanghai"
  47. networks:
  48. - kphcdr
  49. redis:
  50. container_name: ${ABBREVIATION}-redis
  51. image: docker.io/redis:6.2.7
  52. restart: always
  53. volumes:
  54. - ./data/redis:/data
  55. networks:
  56. - kphcdr
  57. ports:
  58. - "${NUMBER}6379:6379"