-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (56 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
76 lines (56 loc) · 1.82 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
# LLM-Simulator Dockerfile
# Multi-stage build for minimal production image
# Build stage
FROM rust:1.75-bookworm AS builder
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy manifests
COPY Cargo.toml Cargo.lock ./
COPY rust-toolchain.toml ./
# Create dummy source to cache dependencies
RUN mkdir -p src/bin && \
echo "fn main() {}" > src/bin/dummy.rs && \
echo "pub fn dummy() {}" > src/lib.rs
# Build dependencies (cached layer)
RUN cargo build --release --bin dummy || true
# Copy actual source code
COPY src ./src
COPY benches ./benches
# Build the application
RUN cargo build --release --bin llm-simulator
# Runtime stage
FROM debian:bookworm-slim AS runtime
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -r -s /bin/false simulator
# Copy binary from builder
COPY --from=builder /app/target/release/llm-simulator /usr/local/bin/
# Copy default configuration
COPY config/default.yaml /etc/llm-simulator/config.yaml
# Set ownership
RUN chown -R simulator:simulator /etc/llm-simulator
# Switch to non-root user
USER simulator
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Default command
ENTRYPOINT ["llm-simulator"]
CMD ["--config", "/etc/llm-simulator/config.yaml"]
# Labels
LABEL org.opencontainers.image.title="LLM-Simulator"
LABEL org.opencontainers.image.description="Enterprise-grade offline LLM API simulator"
LABEL org.opencontainers.image.version="1.0.0"
LABEL org.opencontainers.image.source="https://github.com/llm-devops/llm-simulator"