docker-compose.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. services:
  2. app:
  3. build:
  4. context: .
  5. dockerfile: Dockerfile
  6. args:
  7. - UID=${UID:-1000}
  8. - GID=${GID:-1000}
  9. restart: unless-stopped
  10. tty: true
  11. environment:
  12. - SERVICE_NAME=app
  13. - SERVICE_TAGS=production
  14. volumes:
  15. - ./:/var/www
  16. - ./docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini
  17. networks:
  18. - cpa-network
  19. depends_on:
  20. - app-queue
  21. app-queue:
  22. build:
  23. context: .
  24. dockerfile: Dockerfile
  25. args:
  26. - UID=${UID:-1000}
  27. - GID=${GID:-1000}
  28. restart: unless-stopped
  29. tty: true
  30. command: php artisan queue:work --tries=3
  31. environment:
  32. - SERVICE_NAME=app-queue
  33. - SERVICE_TAGS=production
  34. volumes:
  35. - ./:/var/www
  36. - ./docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini
  37. networks:
  38. - cpa-network
  39. depends_on:
  40. db:
  41. condition: service_healthy
  42. redis:
  43. condition: service_healthy
  44. webserver:
  45. condition: service_started
  46. websocket:
  47. condition: service_started
  48. # minio:
  49. # condition: service_healthy
  50. # Vite Service -- DUMMY FOR PRODUCTION MODE ------------------------------------------------------------------------
  51. vite:
  52. build:
  53. context: .
  54. dockerfile: docker/nginx/Dockerfile
  55. restart: no
  56. tty: true
  57. command: '/bin/sh -c ''echo Production mode! Exit!'''
  58. ports:
  59. - 5172:5172
  60. volumes:
  61. - ./public:/var/frontend
  62. - ./:/var/www
  63. - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
  64. networks:
  65. - cpa-network
  66. #Nginx Service
  67. webserver:
  68. build:
  69. context: .
  70. dockerfile: docker/nginx/Dockerfile
  71. restart: unless-stopped
  72. tty: true
  73. command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
  74. ports:
  75. - ${WEB_PORT:-80}:80
  76. volumes:
  77. - ./public:/var/frontend
  78. - ./:/var/www
  79. - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
  80. networks:
  81. - cpa-network
  82. #MySQL Service
  83. db:
  84. image: mysql:8.0
  85. command: --default-authentication-plugin=mysql_native_password
  86. restart: unless-stopped
  87. tty: true
  88. environment:
  89. - MYSQL_DATABASE=${DB_DATABASE}
  90. - MYSQL_ROOT_PASSWORD=root
  91. - MYSQL_USER=${DB_USERNAME}
  92. - MYSQL_PASSWORD=${DB_PASSWORD}
  93. - SERVICE_TAGS=production
  94. - SERVICE_NAME=mysql
  95. - TZ=${APP_TIMEZONE}
  96. healthcheck:
  97. test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD
  98. start_period: 5s
  99. interval: 5s
  100. timeout: 5s
  101. retries: 255
  102. volumes:
  103. - ./docker/mysql/my.cnf:/etc/my.cnf
  104. - ./docker/database:/var/lib/mysql
  105. networks:
  106. - cpa-network
  107. websocket:
  108. build:
  109. context: docker/simple-ws
  110. dockerfile: Dockerfile
  111. volumes:
  112. - ./docker/simple-ws/server.js:/app/server.js
  113. restart: unless-stopped
  114. environment:
  115. - JWT_SECRET=${JWT_SECRET}
  116. - REDIS_PASSWORD=${REDIS_PASSWORD}
  117. tty: true
  118. command: '/bin/sh -c ''node server'''
  119. ports:
  120. - ${WS_PORT:-3000}:9000
  121. networks:
  122. - cpa-network
  123. depends_on:
  124. redis:
  125. condition: service_healthy
  126. redis:
  127. image: "redis:alpine"
  128. command: redis-server --requirepass ${REDIS_PASSWORD}
  129. environment:
  130. - REDIS_REPLICATION_MODE=master
  131. networks:
  132. - cpa-network
  133. healthcheck:
  134. test: redis-cli --raw --pass $$REDIS_PASSWORD incr ping
  135. start_period: 1s
  136. interval: 1s
  137. timeout: 3s
  138. retries: 255
  139. # minio:
  140. # image: minio/minio
  141. # volumes:
  142. # - minio-data:/data
  143. # command: server --console-address 0.0.0.0:39757 /data
  144. # environment:
  145. # - MINIO_ACCESS_KEY=root
  146. # - MINIO_SECRET_KEY=root1234
  147. # - CONSOLE_SECURE_TLS_REDIRECT=off
  148. # networks:
  149. # - cpa-network
  150. # healthcheck:
  151. # test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
  152. # interval: 30s
  153. # timeout: 20s
  154. # retries: 3
  155. #
  156. # createbuckets:
  157. # image: minio/mc
  158. # entrypoint: >
  159. # /bin/sh -c "
  160. # /usr/bin/mc alias set myminio http://minio:9000 root root1234;
  161. # /usr/bin/mc mb myminio/storage --region=us-east-1;
  162. # /usr/bin/mc anonymous set public myminio/storage;
  163. # exit 0;
  164. # "
  165. # networks:
  166. # - cpa-network
  167. # depends_on:
  168. # minio:
  169. # condition: service_healthy
  170. #Docker Networks
  171. networks:
  172. cpa-network:
  173. driver: bridge
  174. name: ${COMPOSE_PROJECT_NAME}-network
  175. #Volumes
  176. #volumes:
  177. # redis:
  178. # minio-data: