docker-stack.yml 982 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # this file is meant for Docker Swarm stacks only
  2. # trying it in compose will fail because of multiple replicas trying to bind to the same port
  3. # Swarm currently does not support Compose Spec, so we'll pin to the older version 3.9
  4. version: "3.9"
  5. services:
  6. redis:
  7. image: redis:alpine
  8. networks:
  9. - frontend
  10. db:
  11. image: postgres:15-alpine
  12. environment:
  13. POSTGRES_USER: "postgres"
  14. POSTGRES_PASSWORD: "postgres"
  15. volumes:
  16. - db-data:/var/lib/postgresql/data
  17. networks:
  18. - backend
  19. vote:
  20. image: dockersamples/examplevotingapp_vote
  21. ports:
  22. - 5000:80
  23. networks:
  24. - frontend
  25. deploy:
  26. replicas: 1
  27. result:
  28. image: dockersamples/examplevotingapp_result
  29. ports:
  30. - 5001:80
  31. networks:
  32. - backend
  33. worker:
  34. image: dockersamples/examplevotingapp_worker
  35. networks:
  36. - frontend
  37. - backend
  38. deploy:
  39. replicas: 1
  40. networks:
  41. frontend:
  42. backend:
  43. volumes:
  44. db-data: