Problem
mpm compose up --watch correctly detects source file changes in build context directories and re-triggers the deploy cycle, but Docker's build layer cache is not invalidated. The container keeps running with old code.
Root Cause
In utils/mows-cli/src/package_manager/compose/docker.rs, compose_up passes --build but never --no-cache:
cmd.arg("up");
if options.build {
cmd.arg("--build");
}
--build alone relies on Docker's BuildKit layer cache. When COPY src src encounters the same content hash (stale cache), it skips rebuilding even though files changed.
Expected Behavior
When --watch detects changes in a build context directory, the subsequent rebuild should pick up the new source files.
Suggested Fix
When the watch detects a change in a build context directory (as extracted by extract_build_contexts), pass --no-cache for that specific service's rebuild. This avoids unnecessarily rebuilding all services while ensuring changed contexts are rebuilt fresh.
Alternatively, a simpler approach: always pass --no-cache during watch-triggered rebuilds (not on the initial deploy).
Reproduction
mpm compose up --watch on a project with a Rust API build context
- Modify a source file in the build context
- Watch triggers a re-deploy, but the container runs old code
docker compose build --no-cache api followed by mpm compose up correctly picks up changes
Problem
mpm compose up --watchcorrectly detects source file changes in build context directories and re-triggers the deploy cycle, but Docker's build layer cache is not invalidated. The container keeps running with old code.Root Cause
In
utils/mows-cli/src/package_manager/compose/docker.rs,compose_uppasses--buildbut never--no-cache:--buildalone relies on Docker's BuildKit layer cache. WhenCOPY src srcencounters the same content hash (stale cache), it skips rebuilding even though files changed.Expected Behavior
When
--watchdetects changes in a build context directory, the subsequent rebuild should pick up the new source files.Suggested Fix
When the watch detects a change in a build context directory (as extracted by
extract_build_contexts), pass--no-cachefor that specific service's rebuild. This avoids unnecessarily rebuilding all services while ensuring changed contexts are rebuilt fresh.Alternatively, a simpler approach: always pass
--no-cacheduring watch-triggered rebuilds (not on the initial deploy).Reproduction
mpm compose up --watchon a project with a Rust API build contextdocker compose build --no-cache apifollowed bympm compose upcorrectly picks up changes