Snippets / Compose
Local dev override
A docker-compose.override.yml that bind-mounts source and enables hot reload, merged automatically over the base file.
developmentoverridebind-mount
docker-compose.override.yml
services:
web:
volumes:
# Bind-mount the whole project so edits on the host show up inside
# the container immediately -- no rebuild needed.
- .:/app
# Anonymous volume that shadows the bind mount above for just this
# one path, so the image's own node_modules (built for Linux) isn't
# replaced by whatever node_modules sits on the host.
- /app/node_modules
environment:
NODE_ENV: development
# Overrides the image's CMD with the dev server, which the production
# image doesn't ship at all.
command: npm run dev
More compose snippets