Advertisement
marrruuuuuuuu

Docker compose for java backend

Jun 3rd, 2022
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. version: '3.1'
  2. services:
  3. API:
  4. image: theatre-app
  5. ports:
  6. - "8080:8080"
  7. depends_on:
  8. - PostgreSQL
  9. environment:
  10. - SPRING_DATASOURCE_URL=jdbc:postgresql://PostgreSQL:5432/db1
  11. - SPRING_DATASOURCE_USERNAME=postgres
  12. - SPRING_DATASOURCE_PASSWORD=postgres
  13. - SPRING_JPA_HIBERNATE_DDL_AUTO=update
  14. networks:
  15. - backend
  16. - frontend
  17.  
  18. PostgreSQL:
  19. image: postgres
  20. ports:
  21. - "5432:5432"
  22. environment:
  23. - POSTGRES_PASSWORD=postgres
  24. - POSTGRES_USER=postgres
  25. - POSTGRES_DB=db1
  26. healthcheck:
  27. test: [ "CMD-SHELL", "pg_isready -U postgres" ]
  28. interval: 10s
  29. timeout: 5s
  30. retries: 5
  31. networks:
  32. - backend
  33.  
  34. frontend:
  35. image: theatre-front
  36. build:
  37. dockerfile: Dockerfile
  38. args:
  39. REACT_APP_API_BASE_URL: http://localhost:3000
  40. ports:
  41. - "9090:80" # Map the exposed port 80 on the container to port 9090 on the host machine
  42. restart: always
  43. depends_on:
  44. - API
  45. networks:
  46. - frontend
  47.  
  48. # Networks to be created to facilitate communication between containers
  49. networks:
  50. backend:
  51. frontend:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement