-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
49 lines (37 loc) · 1.21 KB
/
Dockerfile.backend
File metadata and controls
49 lines (37 loc) · 1.21 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
# ===== Builder stage =====
FROM nvidia/cuda:12.3.2-devel-ubuntu22.04 AS builder
ENV CUDA_HOME=/usr/local/cuda
ENV CARGO_HOME=/usr/local/cargo
ENV RUSTUP_HOME=/usr/local/rustup
ENV PATH=/usr/local/cargo/bin:/usr/local/cuda/bin:$PATH
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
ENV CUDA_COMPUTE_CAP=86
RUN apt-get update && apt-get install -y \
curl \
protobuf-compiler \
build-essential \
pkg-config \
libssl-dev \
libasound2-dev \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Rust first (before WORKDIR for better caching)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --no-modify-path --default-toolchain 1.93
WORKDIR /app
COPY . .
# Build
RUN cargo build --release -p server
# ===== Runtime stage =====
FROM nvidia/cuda:12.3.2-runtime-ubuntu22.04
ENV CUDA_HOME=/usr/local/cuda
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
ENV MODEL_NAME=whisper-tiny.en
RUN apt-get update && apt-get install -y \
ca-certificates \
libasound2 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/server /usr/local/bin/server
EXPOSE 3000
CMD ["sh", "-c", "server --model ${MODEL_NAME}"]