-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (37 loc) · 1.54 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (37 loc) · 1.54 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
# syntax=docker/dockerfile:1
ARG RUST_VERSION=1.96.0
ARG LLMROUTER_SOURCE_REVISION=unknown
ARG LLMROUTER_SOURCE_STATE=unknown
FROM rust:${RUST_VERSION}-bookworm AS builder
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY migrations ./migrations
RUN cargo build --release --locked
FROM debian:bookworm-slim AS runtime
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
RUN useradd --system --home /nonexistent --shell /usr/sbin/nologin llmrouter
RUN mkdir -p /data /config \
&& chown -R llmrouter:llmrouter /data /config
COPY --from=builder /app/target/release/model-port /usr/local/bin/model-port
# Keep source metadata after dependency and binary layers so a new commit label
# does not invalidate the slow apt or Rust build cache.
ARG LLMROUTER_SOURCE_REVISION
ARG LLMROUTER_SOURCE_STATE
LABEL org.opencontainers.image.title="LLMRouter" \
org.opencontainers.image.source="https://github.com/developer/LLMRouter" \
org.opencontainers.image.revision="$LLMROUTER_SOURCE_REVISION" \
io.llmrouter.source-state="$LLMROUTER_SOURCE_STATE"
USER llmrouter
ENV LLMROUTER_BIND=0.0.0.0:38082
ENV LLMROUTER_STATE_DIR=/data
ENV LLMROUTER_CONTROL_STORE=/data/control-plane.json
ENV LLMROUTER_CONFIG=/config/config.toml
ENV RUST_LOG=model_port=info,tower_http=info
EXPOSE 38082
VOLUME ["/data"]
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -fsS http://127.0.0.1:38082/livez >/dev/null || exit 1
ENTRYPOINT ["/usr/local/bin/model-port"]