compose.yaml 853 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. image: postgres
  13. restart: always
  14. user: postgres
  15. secrets:
  16. - db-password
  17. volumes:
  18. - db-data:/var/lib/postgresql/data
  19. environment:
  20. - POSTGRES_DB=example
  21. - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
  22. expose:
  23. - 5432
  24. healthcheck:
  25. test: [ "CMD", "pg_isready" ]
  26. interval: 10s
  27. timeout: 5s
  28. retries: 5
  29. proxy:
  30. image: nginx
  31. volumes:
  32. - type: bind
  33. source: ./proxy/nginx.conf
  34. target: /etc/nginx/conf.d/default.conf
  35. read_only: true
  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