4
0

compose.yaml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. services:
  2. backend:
  3. build: backend
  4. restart: always
  5. secrets:
  6. - db-password
  7. environment:
  8. MYSQL_HOST: db
  9. networks:
  10. - react-spring
  11. - spring-mysql
  12. depends_on:
  13. db:
  14. condition: service_healthy
  15. db:
  16. # We use a mariadb image which supports both amd64 & arm64 architecture
  17. image: mariadb:11.8
  18. # If you really want to use MySQL, uncomment the following line
  19. #image: mysql:8.0.19
  20. environment:
  21. - MARIADB_AUTO_UPGRADE=1
  22. - MYSQL_DATABASE=example
  23. - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
  24. restart: always
  25. healthcheck:
  26. # healthcheck.sh ships with the mariadb image, mysqladmin with the mysql one
  27. test: ["CMD-SHELL", "healthcheck.sh --connect --innodb_initialized || mysqladmin ping -h 127.0.0.1 --silent"]
  28. interval: 3s
  29. retries: 5
  30. start_period: 30s
  31. secrets:
  32. - db-password
  33. volumes:
  34. - db-data:/var/lib/mysql
  35. networks:
  36. - spring-mysql
  37. frontend:
  38. build:
  39. context: frontend
  40. target: development
  41. ports:
  42. - 3000:3000
  43. volumes:
  44. - ./frontend/src:/code/src
  45. - /project/node_modules
  46. networks:
  47. - react-spring
  48. depends_on:
  49. - backend
  50. expose:
  51. - 3306
  52. - 33060
  53. volumes:
  54. db-data: {}
  55. secrets:
  56. db-password:
  57. file: db/password.txt
  58. networks:
  59. react-spring: {}
  60. spring-mysql: {}