compose.yaml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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:10.6.4-focal
  18. # If you really want to use MySQL, uncomment the following line
  19. #image: mysql:8.0.19
  20. environment:
  21. - MYSQL_DATABASE=example
  22. - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
  23. restart: always
  24. healthcheck:
  25. test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
  26. interval: 3s
  27. retries: 5
  28. start_period: 30s
  29. secrets:
  30. - db-password
  31. volumes:
  32. - db-data:/var/lib/mysql
  33. networks:
  34. - spring-mysql
  35. frontend:
  36. build:
  37. context: frontend
  38. target: development
  39. ports:
  40. - 3000:3000
  41. volumes:
  42. - ./frontend/src:/code/src
  43. - /project/node_modules
  44. networks:
  45. - react-spring
  46. depends_on:
  47. - backend
  48. expose:
  49. - 3306
  50. - 33060
  51. volumes:
  52. db-data: {}
  53. secrets:
  54. db-password:
  55. file: db/password.txt
  56. networks:
  57. react-spring: {}
  58. spring-mysql: {}