Fix Docker build caching with checksum-based rsync
Replace timestamp-based rsync + touch with checksum-based sync: - Use --checksum to only transfer files with actual content changes - Remove touch mechanism that caused all files to appear "newer" - Exclude .git, logs, .idea, node_modules from sync The old approach created a perpetual timestamp mismatch: 1. rsync -a preserved host timestamps 2. touch set container timestamps 3. Next build saw mismatch → transferred everything → touched again With --checksum mode: - Changed files: transferred with current time → rebuilt (correct) - Unchanged files: not transferred → keep timestamp → no rebuild (correct) Tested scenarios: - Consecutive builds: ~2 min (cached) vs ~6+ min (was full rebuild) - Modified wxWidgets file: only that file recompiled - Modified KiCad file: only that file recompiled 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ac48f7c57a
commit
a0a6023400
1 changed files with 12 additions and 8 deletions
|
|
@ -28,16 +28,20 @@ fi
|
|||
# Start container if not running
|
||||
docker compose -f docker/docker-compose.yml up -d
|
||||
|
||||
# Sync source code to container volume (fixes macOS Docker timestamp issues)
|
||||
# rsync -a preserves host timestamps, but make needs container timestamps to
|
||||
# correctly detect changes against cached object files. We touch transferred
|
||||
# files to set their mtime to container's current time.
|
||||
# Sync source code to container volume (fixes macOS Docker VirtioFS issues)
|
||||
# Use --checksum to only transfer files with different CONTENT, not timestamps.
|
||||
# This avoids the timestamp mismatch cycle that caused full rebuilds every time.
|
||||
# Transferred files get current container time, so make detects them correctly.
|
||||
echo "Syncing source code to container..."
|
||||
docker compose -f docker/docker-compose.yml exec kicad-wasm-builder \
|
||||
bash -c 'rsync -ai --delete --exclude="build-wasm" --exclude="output" /workspace-host/ /workspace/ | \
|
||||
grep "^>f" | \
|
||||
sed "s/^[^ ]* //" | \
|
||||
while read f; do touch "/workspace/$f" 2>/dev/null; done'
|
||||
rsync -r --delete --checksum \
|
||||
--exclude="build-wasm" \
|
||||
--exclude="output" \
|
||||
--exclude=".git" \
|
||||
--exclude="logs" \
|
||||
--exclude=".idea" \
|
||||
--exclude="node_modules" \
|
||||
/workspace-host/ /workspace/
|
||||
|
||||
# Run build command (without asyncify - handled on host due to memory requirements)
|
||||
docker compose -f docker/docker-compose.yml exec kicad-wasm-builder \
|
||||
|
|
|
|||
Loading…
Reference in a new issue