compose.yaml 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. services:
  2. backend:
  3. build:
  4. context: backend
  5. target: builder
  6. secrets:
  7. - db-password
  8. depends_on:
  9. db:
  10. condition: service_healthy
  11. db:
  12. # We use a mariadb image which supports both amd64 & arm64 architecture
  13. image: mariadb:10-focal
  14. # If you really want to use MySQL, uncomment the following line
  15. #image: mysql:8
  16. command: '--default-authentication-plugin=mysql_native_password'
  17. restart: always
  18. healthcheck:
  19. test: ['CMD-SHELL', 'mysqladmin ping -h 127.0.0.1 --password="$$(cat /run/secrets/db-password)" --silent']
  20. interval: 3s
  21. retries: 5
  22. start_period: 30s
  23. secrets:
  24. - db-password
  25. volumes:
  26. - db-data:/var/lib/mysql
  27. environment:
  28. - MYSQL_DATABASE=example
  29. - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db-password
  30. expose:
  31. - 3306
  32. proxy:
  33. image: nginx
  34. volumes:
  35. - type: bind
  36. source: ./proxy/nginx.conf
  37. target: /etc/nginx/conf.d/default.conf
  38. read_only: true
  39. ports:
  40. - 80:80
  41. depends_on:
  42. - backend
  43. volumes:
  44. db-data:
  45. secrets:
  46. db-password:
  47. file: db/password.txt