-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (55 loc) · 1.85 KB
/
Dockerfile
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
# syntax = docker/dockerfile:1.4
################################################################################
#FROM ubuntu:22.04 AS base
FROM nvidia/cuda:11.8.0-base-ubuntu22.04 as base
################################################################################
FROM base AS builder
RUN set -eux; \
apt update; \
apt install -y --no-install-recommends \
openssh-client git-core curl ca-certificates gcc libc6-dev \
pkg-config libssl-dev cmake g++ \
;
# Install rustup
RUN set -eux; \
curl --location --fail \
"https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init" \
--output rustup-init; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --default-toolchain stable; \
rm rustup-init;
ENV PATH=${PATH}:/root/.cargo/bin
# Copy sources and build them
WORKDIR /app
ENV TORCH_CUDA_VERSION cu118
ENV LIBTORCH /app/libtorch
ENV LD_LIBRARY_PATH /app/libtorch/lib:$LD_LIBRARY_PATH
COPY . .
RUN --mount=type=cache,target=/root/.rustup \
--mount=type=cache,target=/root/.cargo/registry \
--mount=type=cache,target=/root/.cargo/git \
--mount=type=cache,target=/app/target \
set -eux; \
cargo build --release; \
objcopy /app/target/release/airs /app/airs;
################################################################################
FROM base AS app
SHELL ["/bin/bash", "-c"]
WORKDIR /app
RUN apt-get update -y \
&& apt-get install -y --no-install-recommends openssl ca-certificates libgomp1 curl \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV TORCH_CUDA_VERSION cu118
ENV LIBTORCH /app/libtorch
ENV LD_LIBRARY_PATH /app/libtorch/lib:$LD_LIBRARY_PATH
# Copy app from builder
WORKDIR /app
COPY configuration configuration
COPY .ai-data .ai-data
COPY ssl ssl
COPY --from=builder /app/airs airs
COPY --from=builder /app/libtorch libtorch
CMD ["/app/airs"]