docker-compose.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. version: "3.3"
  2. services:
  3. # mysql 容器
  4. mysql:
  5. container_name: crmeb_mysql #指定容器名
  6. # image: daocloud.io/library/mysql:5.7.5-m15 #M1芯片可以采用这个镜像
  7. image: mysql:5.7 #一般电脑可以用这个镜像
  8. ports:
  9. - 3366:3306
  10. # 环境变量
  11. environment:
  12. TZ: Asia/Shanghai
  13. MYSQL_ROOT_PASSWORD: '123456'
  14. MYSQL_USER: 'crmeb'
  15. MYSQL_PASS: '123456'
  16. MYSQL_DATABASE: 'crmeb'
  17. privileged: true
  18. command:
  19. --character-set-server=utf8mb4
  20. --collation-server=utf8mb4_general_ci
  21. --explicit_defaults_for_timestamp=true
  22. --lower_case_table_names=1
  23. --max_allowed_packet=128M
  24. --default-authentication-plugin=mysql_native_password
  25. --sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
  26. working_dir: /var/lib/mysql
  27. volumes:
  28. - ./mysql/my.cnf:/etc/mysql/my.cnf
  29. - ./mysql/data:/var/lib/mysql #挂载数据目录到本地
  30. - ./mysql/log:/var/log/mysql
  31. networks:
  32. app_net:
  33. # 固定子网ip,网段必须在子网络192.168.*.*
  34. ipv4_address: 192.168.10.1
  35. # redis 容器
  36. redis:
  37. container_name: crmeb_redis
  38. image: 'redis:latest'
  39. ports:
  40. - "6399:6379"
  41. command: redis-server /usr/local/etc/redis/redis.conf
  42. volumes:
  43. - ./redis/data:/data #挂载数据目录到本地
  44. - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
  45. networks:
  46. app_net:
  47. ipv4_address: 192.168.10.10
  48. # php 容器
  49. crmeb-pro:
  50. container_name: crmeb_pro #指定容器名
  51. image: crmeb-pro #指定镜像名
  52. build:
  53. context: ./php #dockerfile文件路径
  54. dockerfile: Dockerfile #制定dockerfile文件名称
  55. restart: always
  56. environment:
  57. TZ: Asia/Shanghai
  58. ports:
  59. - 20699:20699
  60. tmpfs: /var/temp #上传临时文件夹
  61. working_dir: /var/www
  62. volumes:
  63. - ../../:/var/www #程序运行目录
  64. - ../../runtime:/var/www/temp #程序缓存目录
  65. - ./php/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini
  66. command:
  67. php think swoole
  68. networks:
  69. app_net:
  70. ipv4_address: 192.168.10.90
  71. networks: #网络配置
  72. app_net: #网络名称
  73. driver: bridge
  74. ipam: #网络配置
  75. config:
  76. - subnet: 192.168.0.0/16 #IP区间
  77. gateway: 192.168.10.100