Skip to Content

How does bind-mounting the source folder speed up dev?

Category: DevOps & Deployment

Answer

Without bind mount: edit a file on host -> docker build -> docker run again. With - .:/app the container sees the host file directly; FastAPI/uvicorn with —reload picks up the change in < 1 s. The catch: node_modules and .venv must NOT be bind-mounted (use anonymous volumes) so Linux-built deps aren’t replaced by Mac-built ones.

Concrete examples from the fca project context

Example 1

web: volumes: [.:/app, /app/.venv] — source overrides source, anonymous volume protects deps.

Example 2

worker: same pattern, ignores healthcheck (no HTTP port).

Example 3

Streamlit: same source mount + streamlit run --server.runOnSave=true.

Data flow / flow chart

Edit file on host -> bind mount path -> uvicorn --reload
  Anonymous volumes protect Linux-built deps on Mac

Takeaway

Bind-mount source + anonymous-volume deps is the dev pattern that saves 10 minutes per change.