-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.zeroclaw
More file actions
77 lines (65 loc) · 2.9 KB
/
Dockerfile.zeroclaw
File metadata and controls
77 lines (65 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# syntax=docker/dockerfile:1.7
# Custom ZeroClaw image for ZeroOne platform.
# web/dist is pre-built (contains ?token= auto-auth patch).
#
# Build: docker build -f Dockerfile.zeroclaw -t ghcr.io/<user>/zeroclaw:latest ./zeroclaw
# Push: docker push ghcr.io/<user>/zeroclaw:latest
# ── Stage 1: Build Rust binary ───────────────────────────────────────────────
FROM rust:1.93-slim AS builder
WORKDIR /app
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Cache dependencies first
COPY Cargo.toml Cargo.lock ./
COPY crates/robot-kit/Cargo.toml crates/robot-kit/Cargo.toml
RUN mkdir -p src benches crates/robot-kit/src \
&& echo "fn main() {}" > src/main.rs \
&& echo "fn main() {}" > benches/agent_benchmarks.rs \
&& echo "pub fn placeholder() {}" > crates/robot-kit/src/lib.rs
RUN --mount=type=cache,id=zeroone-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,id=zeroone-cargo-git,target=/usr/local/cargo/git,sharing=locked \
--mount=type=cache,id=zeroone-target,target=/app/target,sharing=locked \
cargo build --release --locked
RUN rm -rf src benches crates/robot-kit/src
# Copy source + pre-built web/dist (already has ?token= patch)
COPY src/ src/
COPY benches/ benches/
COPY crates/ crates/
COPY firmware/ firmware/
COPY web/ web/
# Build final binary
RUN --mount=type=cache,id=zeroone-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,id=zeroone-cargo-git,target=/usr/local/cargo/git,sharing=locked \
--mount=type=cache,id=zeroone-target,target=/app/target,sharing=locked \
cargo build --release --locked && \
cp target/release/zeroclaw /app/zeroclaw && \
strip /app/zeroclaw
# Prepare runtime dirs + default config
RUN mkdir -p /zeroclaw-data/.zeroclaw /zeroclaw-data/workspace && \
cat > /zeroclaw-data/.zeroclaw/config.toml <<'EOF'
workspace_dir = "/zeroclaw-data/workspace"
config_path = "/zeroclaw-data/.zeroclaw/config.toml"
api_key = ""
default_provider = "openrouter"
default_model = "anthropic/claude-sonnet-4-20250514"
default_temperature = 0.7
[gateway]
port = 42617
host = "0.0.0.0"
allow_public_bind = true
EOF
RUN chown -R 65534:65534 /zeroclaw-data
# ── Stage 2: Production runtime (distroless) ─────────────────────────────────
FROM gcr.io/distroless/cc-debian13:nonroot AS release
COPY --from=builder /app/zeroclaw /usr/local/bin/zeroclaw
COPY --from=builder /zeroclaw-data /zeroclaw-data
ENV ZEROCLAW_WORKSPACE=/zeroclaw-data/workspace
ENV HOME=/zeroclaw-data
ENV ZEROCLAW_GATEWAY_PORT=42617
WORKDIR /zeroclaw-data
USER 65534:65534
EXPOSE 42617
ENTRYPOINT ["zeroclaw"]
CMD ["gateway"]