fix(docker): include workspace crate manifests in prebuild stage
This commit is contained in:
parent
4443406311
commit
21b91dfea4
10
Dockerfile
10
Dockerfile
@ -16,11 +16,15 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
# 1. Copy manifests to cache dependencies
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY crates/robot-kit/Cargo.toml crates/robot-kit/Cargo.toml
|
||||
COPY crates/zeroclaw-types/Cargo.toml crates/zeroclaw-types/Cargo.toml
|
||||
COPY crates/zeroclaw-core/Cargo.toml crates/zeroclaw-core/Cargo.toml
|
||||
# Create dummy targets declared in Cargo.toml so manifest parsing succeeds.
|
||||
RUN mkdir -p src benches crates/robot-kit/src \
|
||||
RUN mkdir -p src benches crates/robot-kit/src crates/zeroclaw-types/src crates/zeroclaw-core/src \
|
||||
&& echo "fn main() {}" > src/main.rs \
|
||||
&& echo "fn main() {}" > benches/agent_benchmarks.rs \
|
||||
&& echo "pub fn placeholder() {}" > crates/robot-kit/src/lib.rs
|
||||
&& echo "pub fn placeholder() {}" > crates/robot-kit/src/lib.rs \
|
||||
&& echo "pub fn placeholder() {}" > crates/zeroclaw-types/src/lib.rs \
|
||||
&& echo "pub fn placeholder() {}" > crates/zeroclaw-core/src/lib.rs
|
||||
RUN --mount=type=cache,id=zeroclaw-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \
|
||||
--mount=type=cache,id=zeroclaw-cargo-git,target=/usr/local/cargo/git,sharing=locked \
|
||||
--mount=type=cache,id=zeroclaw-target,target=/app/target,sharing=locked \
|
||||
@ -29,7 +33,7 @@ RUN --mount=type=cache,id=zeroclaw-cargo-registry,target=/usr/local/cargo/regist
|
||||
else \
|
||||
cargo build --release --locked; \
|
||||
fi
|
||||
RUN rm -rf src benches crates/robot-kit/src
|
||||
RUN rm -rf src benches crates/robot-kit/src crates/zeroclaw-types/src crates/zeroclaw-core/src
|
||||
|
||||
# 2. Copy only build-relevant source paths (avoid cache-busting on docs/tests/scripts)
|
||||
COPY src/ src/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user