docker-compose.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. version: "3.8"
  2. services:
  3. mysql:
  4. image: mariadb:latest
  5. volumes:
  6. - db-data:/var/lib/mysql
  7. - ./Docker/mysql/mysql.cnf:/etc/mysql/conf.d/custom.cnf:ro
  8. - ./Docker/mysql/bashrc:/root/.bashrc:ro
  9. - "${DB_IMPORTE_FILE}:/docker-entrypoint-initdb.d/ouatterrir.sql"
  10. networks:
  11. - database
  12. hostname: mysql
  13. environment:
  14. MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"
  15. MYSQL_DATABASE: "${DB_NAME}"
  16. MYSQL_USER: "${DB_USERNAME}"
  17. MYSQL_PASSWORD: "${DB_PASSWORD}"
  18. redis:
  19. image: redis:4
  20. command: ["redis-server", "--appendonly", "yes"]
  21. volumes:
  22. - redis-data:/data
  23. networks:
  24. - redis
  25. ports:
  26. - "6389"
  27. phpmyadmin:
  28. image: phpmyadmin/phpmyadmin
  29. ports:
  30. - 8991:80
  31. networks:
  32. - database
  33. depends_on:
  34. - mysql
  35. environment:
  36. PMA_HOSTS: mysql
  37. api:
  38. build: ./Docker/api/
  39. expose:
  40. - 9000
  41. user: ${USER_UID}:${USER_GID}
  42. volumes:
  43. - php-user-data:/home/${USER_UNAME}
  44. - "${API_ROOT}:/var/www/html/api"
  45. - "${LOG_ROOT}/php:/var/log:rw"
  46. - "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini"
  47. working_dir: "/var/www/html/api/src"
  48. networks:
  49. - database
  50. - redis
  51. - server
  52. # for xdebug
  53. # https://github.com/docker/for-linux/issues/264#issuecomment-965465879
  54. extra_hosts:
  55. - host.docker.internal:host-gateway
  56. depends_on:
  57. - mysql
  58. - redis
  59. app:
  60. build: ./Docker/app
  61. user: ${USER_UID}:${USER_GID}
  62. volumes:
  63. - "${APP_ROOT}:/app"
  64. - npm-user-data:/home/${USER_UNAME}
  65. networks:
  66. - app
  67. - server
  68. ports:
  69. - 8988:8988
  70. working_dir: "/app"
  71. environment:
  72. - APP_ENV=dev
  73. nginx:
  74. build: ./Docker/nginx/
  75. ports:
  76. - 8990:80
  77. volumes:
  78. - "${API_ROOT}:/var/www/html/api"
  79. - "${APP_ROOT}:/var/www/html/app"
  80. - "${LOG_ROOT}:/var/log:rw"
  81. working_dir: "/var/www/html/api/"
  82. networks:
  83. - server
  84. depends_on:
  85. - api
  86. - app
  87. # command: [nginx-debug, '-g', 'daemon off;']
  88. volumes:
  89. php-user-data:
  90. db-data:
  91. redis-data:
  92. npm-user-data:
  93. networks:
  94. database:
  95. redis:
  96. server:
  97. app: