Fix Docker build: clean host artifacts after copy to prevent conflicts

- Add cleanup step in copy-source target to remove build/, ollama, and dist/
- Prevents host build artifacts from interfering with container builds
- Ensures clean build environment when switching between host and Docker workflows
- docker cp doesn't respect .dockerignore, so explicit cleanup is needed
This commit is contained in:
Shang Chieh Tseng
2025-11-08 17:16:46 +08:00
parent 94bbfbb2e7
commit 71fc994a63

View File

@@ -114,7 +114,9 @@ stop-builder:
copy-source: start-builder copy-source: start-builder
@echo "→ Copying source code to container..." @echo "→ Copying source code to container..."
@docker cp $(SOURCE_DIR)/. $(CONTAINER_NAME):/usr/local/src/ollama37/ @docker cp $(SOURCE_DIR)/. $(CONTAINER_NAME):/usr/local/src/ollama37/
@echo " Source code copied" @echo "→ Cleaning any host build artifacts from container..."
@docker exec $(CONTAINER_NAME) rm -rf /usr/local/src/ollama37/build /usr/local/src/ollama37/ollama /usr/local/src/ollama37/dist
@echo " Source code copied (clean build environment)"
# Run CMake configuration # Run CMake configuration
run-cmake: copy-source run-cmake: copy-source