docker-compose.yml 3.9 KB

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