docker-compose.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. version : '3'
  2. services:
  3. mysql:
  4. platform: linux/x86_64
  5. container_name: mysql
  6. image: mysql:5.7
  7. build:
  8. context: .
  9. dockerfile: mysql-dockerfile
  10. ports:
  11. - "3306:3306"
  12. volumes:
  13. - ./mysql/conf:/etc/mysql/conf.d
  14. - ./mysql/logs:/logs
  15. - ./mysql/data:/var/lib/mysql
  16. command: [
  17. 'mysqld',
  18. '--innodb-buffer-pool-size=80M',
  19. '--character-set-server=utf8mb4',
  20. '--collation-server=utf8mb4_unicode_ci',
  21. '--default-time-zone=+8:00',
  22. '--lower-case-table-names=1'
  23. ]
  24. environment:
  25. MYSQL_DATABASE: ${DB_NAME}
  26. MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
  27. networks:
  28. - app-network
  29. redis:
  30. image: redis:5.0
  31. ports:
  32. - "6379:6379"
  33. restart: always
  34. networks:
  35. - app-network
  36. backend:
  37. container_name: backend
  38. build:
  39. context: .
  40. dockerfile: backend-dockerfile
  41. ports:
  42. - "8081:8080"
  43. volumes:
  44. - ./zyc/logs:/home/zyc/logs
  45. - ./zyc/uploadPath:/home/zyc/uploadPath
  46. depends_on:
  47. - mysql
  48. links:
  49. - mysql
  50. environment:
  51. DB_HOST: ${DB_HOST}
  52. DB_USERNAME: ${DB_USERNAME}
  53. DB_PASSWORD: ${DB_PASSWORD}
  54. DB_NAME: ${DB_NAME}
  55. DB_PORT: ${DB_PORT}
  56. REDIS_HOST: ${REDIS_HOST}
  57. REDIS_PORT: ${REDIS_PORT}
  58. REDIS_PASSWORD: ${REDIS_PASSWORD}
  59. REDIS_DATABASE: ${REDIS_DATABASE}
  60. networks:
  61. - app-network
  62. frontend:
  63. image: frontend # 前端镜像名称
  64. container_name: frontend
  65. build:
  66. context: .
  67. dockerfile: frontend-dockerfile
  68. ports:
  69. - "80:80" # 映射前端服务端口
  70. networks:
  71. - app-network
  72. networks:
  73. app-network:
  74. driver: bridge