docker-compose.yml 1.3 KB

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