A docker-compose template for laravel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

docker-compose.yml 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. version: "3.7"
  2. services:
  3. laravel:
  4. image: eslym/laravel-ca:build4
  5. depends_on:
  6. - database
  7. - redis
  8. ports:
  9. - ${LARAVEL_PORT}
  10. deploy:
  11. mode: global
  12. resources:
  13. limits:
  14. memory: ${LARAVEL_MEM_LIMIT}
  15. restart: always
  16. logging:
  17. driver: "json-file"
  18. options:
  19. max-file: "5"
  20. max-size: 10m
  21. networks:
  22. - laravel-network
  23. volumes:
  24. - type: bind
  25. source: ./src
  26. target: /var/www/html
  27. - type: bind
  28. source: ./composer-cache
  29. target: /root/.composer/cache
  30. env_file:
  31. - ./php.env
  32. - ./fpm.env
  33. environment:
  34. - COMPOSER_INSTALL=no-dev
  35. - TZ=${TZ}
  36. redis:
  37. image: redis:alpine
  38. deploy:
  39. mode: global
  40. restart: always
  41. logging:
  42. driver: "json-file"
  43. options:
  44. max-file: "5"
  45. max-size: 10m
  46. networks:
  47. laravel-network:
  48. aliases:
  49. - redis
  50. volumes:
  51. - type: volume
  52. source: redis-data
  53. target: /data
  54. environment:
  55. - TZ=${TZ}
  56. database:
  57. image: mysql:5.7
  58. ports:
  59. - ${MYSQL_PORT}
  60. deploy:
  61. mode: global
  62. restart: always
  63. logging:
  64. driver: "json-file"
  65. options:
  66. max-file: "5"
  67. max-size: 10m
  68. networks:
  69. laravel-network:
  70. aliases:
  71. - database
  72. volumes:
  73. - type: bind
  74. source: ./database
  75. target: /var/lib/mysql
  76. env_file:
  77. - ./database.env
  78. environment:
  79. - TZ=${TZ}
  80. volumes:
  81. redis-data:
  82. driver: local
  83. networks:
  84. laravel-network:
  85. driver: bridge