docker-compose.yml 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. version: '3.8'
  2. services:
  3. app:
  4. build:
  5. context: .
  6. dockerfile: Dockerfile
  7. volumes:
  8. - ../..:/workspaces:cached
  9. # Overrides default command so things don't shut down after the process ends.
  10. command: sleep infinity
  11. # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
  12. network_mode: service:db
  13. # Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
  14. # (Adding the "ports" property to this file will not forward from a Codespace.)
  15. db:
  16. image: mongo:latest
  17. restart: unless-stopped
  18. volumes:
  19. - mongodb-data:/data/db
  20. # Uncomment to change startup options
  21. # environment:
  22. # MONGO_INITDB_ROOT_USERNAME: root
  23. # MONGO_INITDB_ROOT_PASSWORD: example
  24. # MONGO_INITDB_DATABASE: your-database-here
  25. # Add "forwardPorts": ["27017"] to **devcontainer.json** to forward MongoDB locally.
  26. # (Adding the "ports" property to this file will not forward from a Codespace.)
  27. volumes:
  28. mongodb-data: