-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerfile
More file actions
76 lines (60 loc) · 2.76 KB
/
Copy pathContainerfile
File metadata and controls
76 lines (60 loc) · 2.76 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
# Build llmproxy from source.
#
# podman build -t llmproxy .
#
# Run with GCP Vertex AI (single-backend mode via env vars):
#
# podman run --rm -p 8080:8080 \
# -v $HOME/.config/gcloud:/gcp-creds:ro,z \
# -e GOOGLE_APPLICATION_CREDENTIALS=/gcp-creds/application_default_credentials.json \
# -e LLMPROXY_BACKEND=gcp-vertex \
# -e GOOGLE_CLOUD_PROJECT=my-project \
# -e VERTEX_LOCATION=us-east5 \
# llmproxy
#
# Uses BuildKit cache mounts for fast incremental rebuilds (cargo
# target dir + registry survive across builds on the same host).
# Pattern borrowed from github.com/bootc-dev/bootc.
FROM registry.access.redhat.com/ubi10/ubi:latest AS builder
RUN dnf -y install cargo openssl-devel && dnf clean all
WORKDIR /build
COPY Cargo.toml Cargo.lock ./
COPY crates/ crates/
# Fetch dependencies (cached across builds via the registry mount).
RUN --mount=type=cache,target=/build/target \
--mount=type=cache,target=/root/.cargo/registry \
cargo fetch
# Build with cache mounts. The target dir persists across builds so
# incremental compilation kicks in. --network=none proves all deps
# were fetched above. Copy the binary out of the cache mount into a
# stable location before the layer closes.
RUN --network=none \
--mount=type=cache,target=/build/target \
--mount=type=cache,target=/root/.cargo/registry \
cargo build --release && \
cp target/release/llmproxy /usr/local/bin/llmproxy && \
strip /usr/local/bin/llmproxy
# --- Integration test runner ---
#
# Build: podman build --target integration-runner -t llmproxy-integration .
# Run: podman run --rm llmproxy-integration
#
# Compiles the integration test binary and bundles it with the proxy
# binary so tests can start the proxy and talk to it.
FROM builder AS integration-builder
RUN --mount=type=cache,target=/build/target \
--mount=type=cache,target=/root/.cargo/registry \
cargo test -p llmproxy-proxy --test integration --no-run --message-format=json 2>/dev/null \
| python3 -c "import sys,json; [print(m['executable']) for line in sys.stdin if (m:=json.loads(line)).get('executable')]" \
| while read -r exe; do cp "$exe" /usr/local/bin/llmproxy-integration; done
FROM registry.access.redhat.com/ubi10/ubi-minimal:latest AS integration-runner
RUN microdnf -y install openssl && microdnf clean all
COPY --from=integration-builder /usr/local/bin/llmproxy /usr/local/bin/llmproxy
COPY --from=integration-builder /usr/local/bin/llmproxy-integration /usr/local/bin/llmproxy-integration
CMD ["/usr/local/bin/llmproxy-integration"]
# --- Runtime ---
FROM registry.access.redhat.com/ubi10/ubi-minimal:latest
RUN microdnf -y install openssl && microdnf clean all
COPY --from=builder /usr/local/bin/llmproxy /usr/local/bin/llmproxy
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/llmproxy"]