docker-compose.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. version: '3.8'
  2. volumes:
  3. postgres-data:
  4. services:
  5. app:
  6. build:
  7. context: .
  8. dockerfile: Dockerfile
  9. env_file:
  10. # Ensure that the variables in .env match the same variables in devcontainer.json
  11. - .env
  12. volumes:
  13. - ../..:/workspaces:cached
  14. # Overrides default command so things don't shut down after the process ends.
  15. command: sleep infinity
  16. # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
  17. network_mode: service:mysql
  18. # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
  19. # (Adding the "ports" property to this file will not forward from a Codespace.)
  20. mysql:
  21. image: postgres:latest
  22. restart: unless-stopped
  23. volumes:
  24. - postgres-data:/var/lib/postgresql/data
  25. env_file:
  26. # Ensure that the variables in .env match the same variables in devcontainer.json
  27. - .env
  28. # Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
  29. # (Adding the "ports" property to this file will not forward from a Codespace.)
  30. mongodb:
  31. image: mongo:latest
  32. restart: unless-stopped
  33. volumes:
  34. - mongodb-data:/data/db
  35. env_file:
  36. - .env