docker-compose.yml 1.2 KB

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