-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (28 loc) · 1.27 KB
/
Copy pathDockerfile
File metadata and controls
36 lines (28 loc) · 1.27 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
FROM rust:1.92-bookworm AS builder
WORKDIR /build
COPY README.md ./
COPY Cargo.toml Cargo.lock ./
COPY crates/diffctx-native/Cargo.toml ./crates/diffctx-native/
COPY crates/diffctx-native/src ./crates/diffctx-native/src
COPY crates/diffctx-native/tests ./crates/diffctx-native/tests
WORKDIR /build/crates/diffctx-native
RUN cargo build --release --locked --bin diffctx
FROM debian:bookworm-slim AS runtime
ARG VERSION=0.0.0
LABEL org.opencontainers.image.title="diffctx" \
org.opencontainers.image.description="Selects the minimum code an LLM needs to review a git diff" \
org.opencontainers.image.source="https://github.com/nikolay-e/diffctx" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.version="${VERSION}"
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates git \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /build/target/release/diffctx /usr/local/bin/diffctx
# Bind-mounted host repositories carry foreign ownership; without this git
# refuses to read them ("dubious ownership") and every --diff run fails.
RUN git config --system --add safe.directory '*' \
&& useradd --system --uid 10001 --create-home diffctx
USER 10001:10001
WORKDIR /repo
ENTRYPOINT ["diffctx"]
CMD ["--help"]