compose.yaml 1.2 KB

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