docker-compose.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. - 9001
  42. user: ${USER_UID}:${USER_GID}
  43. volumes:
  44. - php-user-data:/home/${USER_UNAME}
  45. - "${API_ROOT}:/var/www/html/api"
  46. - "${LOG_ROOT}/php:/var/log:rw"
  47. - "${XDEBUG_INI}:/usr/local/etc/php/conf.d/xdebug.ini"
  48. working_dir: "/var/www/html/api/src"
  49. networks:
  50. - database
  51. - redis
  52. - server
  53. # for xdebug
  54. # https://github.com/docker/for-linux/issues/264#issuecomment-965465879
  55. extra_hosts:
  56. - host.docker.internal:host-gateway
  57. depends_on:
  58. - mysql
  59. - redis
  60. app:
  61. build: ./Docker/app
  62. user: ${USER_UID}:${USER_GID}
  63. volumes:
  64. - "${APP_ROOT}:/app"
  65. - npm-user-data:/home/${USER_UNAME}
  66. networks:
  67. - app
  68. - server
  69. ports:
  70. - 5173:5173
  71. working_dir: "/app"
  72. environment:
  73. - APP_ENV=dev
  74. tty: true
  75. nginx:
  76. build: ./Docker/nginx/
  77. ports:
  78. - 8990:80
  79. volumes:
  80. - "${API_ROOT}:/var/www/html/api"
  81. - "${APP_ROOT}:/var/www/html/app"
  82. - "${LOG_ROOT}:/var/log:rw"
  83. working_dir: "/var/www/html/api/"
  84. networks:
  85. - server
  86. depends_on:
  87. - api
  88. - app
  89. # command: [nginx-debug, '-g', 'daemon off;']
  90. volumes:
  91. php-user-data:
  92. db-data:
  93. redis-data:
  94. npm-user-data:
  95. networks:
  96. database:
  97. redis:
  98. server:
  99. app: