-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
69 lines (56 loc) · 1.67 KB
/
Dockerfile
File metadata and controls
69 lines (56 loc) · 1.67 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
# Stage 1: Builder
FROM nvidia/cuda:12.2.2-devel-ubuntu22.04 AS builder
# Install build dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
libssl-dev \
pkg-config \
clang \
libstdc++-12-dev \
cmake \
git && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# CUDA environment variables
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=${CUDA_HOME}/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
ENV CUDA_COMPUTE_CAP=70
# Set working directory
WORKDIR /app
# Copy source files
COPY Cargo.toml ./
COPY redeem-classifiers ./redeem-classifiers
COPY redeem-cli ./redeem-cli
COPY redeem-properties ./redeem-properties
COPY redeem-properties-py ./redeem-properties-py
# Build release binary with CUDA
RUN cargo build --release --bin redeem --features cuda
# Stage 2: Runtime
FROM nvidia/cuda:12.2.2-runtime-ubuntu22.04 AS runtime
# Install minimal runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
libssl3 \
libstdc++6 \
libgomp1 \
&& update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy binary from builder stage
COPY --from=builder /app/target/release/redeem /app/redeem
# CUDA environment variables
ENV CUDA_HOME=/usr/local/cuda
ENV PATH=${CUDA_HOME}/bin:${PATH}
ENV LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
# Add binary directory to PATH
ENV PATH="/app:${PATH}"
ENTRYPOINT ["redeem"]