-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile.gpu
More file actions
55 lines (43 loc) · 1.33 KB
/
Dockerfile.gpu
File metadata and controls
55 lines (43 loc) · 1.33 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
ARG CUDA_VERSION=12.3.2
ARG UBUNTU_VERSION=22.04
ARG RUST_VERSION=stable
# Builder stage
FROM nvidia/cuda:${CUDA_VERSION}-cudnn9-devel-ubuntu${UBUNTU_VERSION} as builder
ARG RUST_VERSION
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
clang \
libclang-dev \
curl \
xz-utils \
pkg-config \
libssl-dev \
zlib1g-dev \
libtinfo-dev \
libxml2-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_VERSION}
ENV PATH="/root/.cargo/bin:${PATH}"
# Copy and build
COPY . .
RUN cargo build --release -p ferrules-api
# Runtime stage
FROM nvidia/cuda:${CUDA_VERSION}-cudnn9-runtime-ubuntu${UBUNTU_VERSION}
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
libssl3 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Set CUDA paths
ENV CUDA_HOME=/usr/local/cuda
ENV PATH="${CUDA_HOME}/bin:${PATH}"
ENV LD_LIBRARY_PATH="${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}"
# Copy the binary and libs from builder
COPY --from=builder /app/target/release/ferrules-api /app/ferrules-api
COPY --from=builder /app/target/release/*onnxruntime*.so* /usr/local/lib/
RUN ldconfig
ENTRYPOINT ["/app/ferrules-api","--cuda","-j2","-O3"]