compose.yaml 1.4 KB

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