4
0

docker-compose.yaml 1.3 KB

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