docker-compose.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. #Nginx Service
  51. webserver:
  52. build:
  53. context: .
  54. dockerfile: docker/nginx/Dockerfile
  55. restart: unless-stopped
  56. tty: true
  57. command: '/bin/sh -c ''while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g "daemon off;"'''
  58. ports:
  59. - ${WEB_PORT:-80}:80
  60. - 5173:5173
  61. volumes:
  62. - ./public:/var/frontend
  63. - ./:/var/www
  64. - ./docker/nginx/conf.d/:/etc/nginx/conf.d/
  65. networks:
  66. - cpa-network
  67. #MySQL Service
  68. db:
  69. image: mysql:8.0
  70. command: --default-authentication-plugin=mysql_native_password
  71. restart: unless-stopped
  72. tty: true
  73. environment:
  74. - MYSQL_DATABASE=${DB_DATABASE}
  75. - MYSQL_ROOT_PASSWORD=root
  76. - MYSQL_USER=${DB_USERNAME}
  77. - MYSQL_PASSWORD=${DB_PASSWORD}
  78. - SERVICE_TAGS=production
  79. - SERVICE_NAME=mysql
  80. - TZ=${APP_TIMEZONE}
  81. healthcheck:
  82. test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$MYSQL_PASSWORD
  83. start_period: 5s
  84. interval: 5s
  85. timeout: 5s
  86. retries: 255
  87. volumes:
  88. - ./docker/mysql/my.cnf:/etc/my.cnf
  89. - ./docker/database:/var/lib/mysql
  90. ports:
  91. - 33061:3306
  92. networks:
  93. - cpa-network
  94. websocket:
  95. build:
  96. context: docker/websocket
  97. dockerfile: Dockerfile
  98. restart: unless-stopped
  99. environment:
  100. - JWT_SECRET=${JWT_SECRET}
  101. - REDIS_PASSWORD=${REDIS_PASSWORD}
  102. tty: true
  103. command: '/bin/sh -c ''node server'''
  104. ports:
  105. - ${WS_PORT:-3000}:3000
  106. networks:
  107. - cpa-network
  108. depends_on:
  109. redis:
  110. condition: service_healthy
  111. redis:
  112. image: "redis:alpine"
  113. command: redis-server --requirepass ${REDIS_PASSWORD}
  114. environment:
  115. - REDIS_REPLICATION_MODE=master
  116. networks:
  117. - cpa-network
  118. healthcheck:
  119. test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
  120. # minio:
  121. # image: minio/minio
  122. # volumes:
  123. # - minio-data:/data
  124. # command: server --console-address 0.0.0.0:39757 /data
  125. # environment:
  126. # - MINIO_ACCESS_KEY=root
  127. # - MINIO_SECRET_KEY=root1234
  128. # - CONSOLE_SECURE_TLS_REDIRECT=off
  129. # networks:
  130. # - cpa-network
  131. # healthcheck:
  132. # test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
  133. # interval: 30s
  134. # timeout: 20s
  135. # retries: 3
  136. #
  137. # createbuckets:
  138. # image: minio/mc
  139. # entrypoint: >
  140. # /bin/sh -c "
  141. # /usr/bin/mc alias set myminio http://minio:9000 root root1234;
  142. # /usr/bin/mc mb myminio/storage --region=us-east-1;
  143. # /usr/bin/mc anonymous set public myminio/storage;
  144. # exit 0;
  145. # "
  146. # networks:
  147. # - cpa-network
  148. # depends_on:
  149. # minio:
  150. # condition: service_healthy
  151. #Docker Networks
  152. networks:
  153. cpa-network:
  154. driver: bridge
  155. name: ${COMPOSE_PROJECT_NAME}-network
  156. #Volumes
  157. #volumes:
  158. # redis:
  159. # minio-data: