forked from EricLBuehler/mistral.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (30 loc) · 1.2 KB
/
Dockerfile
File metadata and controls
39 lines (30 loc) · 1.2 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
# syntax=docker/dockerfile:1
# Stage 1: Build environment
FROM rust:latest AS builder
# Set working directory and copy files
WORKDIR /mistralrs
COPY . .
# Build the project in release mode, excluding the specified workspace
RUN cargo build --release --workspace --exclude mistralrs-pyo3
# Stage 2: Minimal runtime environment
FROM debian:bookworm-slim AS runtime
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
# Install only essential runtime dependencies and clean up
ARG DEBIAN_FRONTEND=noninteractive
RUN <<HEREDOC
apt-get update
apt-get install -y --no-install-recommends \
libomp-dev \
ca-certificates \
libssl-dev \
curl
rm -rf /var/lib/apt/lists/*
HEREDOC
# Copy the built binaries from the builder stage
COPY --chmod=755 --from=builder /mistralrs/target/release/mistralrs-bench /usr/local/bin/
COPY --chmod=755 --from=builder /mistralrs/target/release/mistralrs-server /usr/local/bin/
COPY --chmod=755 --from=builder /mistralrs/target/release/mistralrs-web-chat /usr/local/bin/
# Copy chat templates for users running models which may not include them
COPY --from=builder /mistralrs/chat_templates /chat_templates
ENV HUGGINGFACE_HUB_CACHE=/data \
PORT=80