-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.cuda
56 lines (39 loc) · 1.42 KB
/
Dockerfile.cuda
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
ARG PACKAGE="glowrs-server"
# Build container
FROM nvidia/cuda:12.4.1-devel-ubuntu22.04 AS cuda-base
# Installing rust and cargo chef
RUN apt-get update && \
apt-get install -y curl openssl libssl-dev ca-certificates pkg-config && \
rm -rf /var/lib/apt/lists/* &&\
curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install cargo-chef
RUN cargo install cargo-chef
WORKDIR /build
FROM cuda-base AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM cuda-base AS builder
COPY --from=planner /build/recipe.json recipe.json
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES video,compute,utility
# Build dependencies - this is the caching Docker layer!
RUN cargo chef cook --release --recipe-path recipe.json
# Build application
ARG PACKAGE
COPY . .
RUN cargo build --release --bin $PACKAGE --features cuda
# Final image
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04
# Installing nativetls dependencies
RUN apt-get update && \
apt-get install -y openssl libssl-dev ca-certificates && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
ARG PACKAGE
COPY --from=builder /build/target/release/$PACKAGE /app/$PACKAGE
HEALTHCHECK --interval=30s --start-period=10s --retries=3 CMD bash -c ':> /dev/tcp/0.0.0.0/3000' || exit 1
ENV RUST_LOG="glowrs=debug,server=debug,tower_http=debug,axum::rejection=trace"
# Running
EXPOSE 3000
ENTRYPOINT ["./glowrs-server", "--host", "0.0.0.0"]