Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (48 loc) · 2.37 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (48 loc) · 2.37 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
# ==============================================================================
# Stage 1: Rust Release Builder (hypercache & hypercache-admin)
# ==============================================================================
FROM rust:1-bookworm AS rust-builder
WORKDIR /src/control-plane
# Cache dependency layer first
COPY control-plane/Cargo.toml control-plane/Cargo.lock* ./
RUN mkdir -p src/bin && \
echo "fn main() {}" > src/main.rs && \
echo "fn main() {}" > src/bin/admin.rs && \
echo "" > src/lib.rs && \
cargo build --locked --release && \
rm -rf src
# Copy actual control-plane source and compile release binaries
COPY control-plane/src ./src
RUN touch src/lib.rs src/main.rs src/bin/admin.rs && \
cargo build --locked --release --bins && \
strip target/release/hypercache target/release/hypercache-admin
# ==============================================================================
# Stage 2: Production Runtime Image (Worker Node Daemon, Controller & CLI)
# ==============================================================================
FROM debian:bookworm-slim AS runtime
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
python3 \
python3-pip \
util-linux \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /etc/hypercache
# Copy compiled Rust binaries
COPY --from=rust-builder /src/control-plane/target/release/hypercache /usr/local/bin/hypercache
COPY --from=rust-builder /src/control-plane/target/release/hypercache-admin /usr/local/bin/hypercache-admin
# Copy default configuration templates
COPY configs/hypercache-agent.toml /etc/hypercache/hypercache-agent.toml
COPY configs/hypercache-controller.toml /etc/hypercache/hypercache-controller.toml
# Install Python Data Plane & fsspec integration into container Python environment
COPY client-py /opt/hypercache/client-py
RUN pip3 install --no-cache-dir --break-system-packages -e /opt/hypercache/client-py
# Ensure runtime socket and metadata directories exist
RUN mkdir -p /run/hypercache /var/lib/hypercache /var/cache/hypercache
# Expose optional ports:
# - 9110: Prometheus metrics exporter (--metrics)
# - 9115: Worker Node Agent Fleet & P2P API (--agent)
# - 9120: Central Cluster Controller (hypercache-admin controller)
EXPOSE 9110 9115 9120
ENTRYPOINT ["/usr/local/bin/hypercache"]
CMD ["-c", "/etc/hypercache/hypercache-agent.toml", "start"]