-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.arm
48 lines (35 loc) · 1.84 KB
/
Dockerfile.arm
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
FROM python:3.8-bullseye AS builder
RUN apt-get update \
&& apt-get install curl build-essential ca-certificates tzdata net-tools pkg-config libssl-dev openssl -y \
&& curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path --default-toolchain none -y \
&& $HOME/.cargo/bin/rustup default stable \
&& $HOME/.cargo/bin/rustc --version
RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0
# ENV PATH ~/.cargo/bin:$PATH
WORKDIR /app
COPY . .
ENV LIBTORCH=/usr/local/lib/python3.8/site-packages/torch
ENV DYLD_LIBRARY_PATH=${LIBTORCH}/lib
ENV LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
ENV LIBTORCH_CXX11_ABI=0
RUN ~/.cargo/bin/cargo build --release --bin algo-rust-bert-demo
RUN cp target/release/algo-rust-bert-demo /app/algo-rust-bert-demo
FROM python:3.8-bullseye
WORKDIR /app
ENV GRPC_HEALTH_PROBE_VERSION=v0.4.17
RUN apt-get update \
&& apt-get install curl wget build-essential ca-certificates tzdata net-tools pkg-config libssl-dev openssl -y \
&& wget -qO /bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 \
&& chmod +x /bin/grpc_health_probe \
&& wget -qO /bin/grpcurl_1.8.7_linux_x86_64.tar.gz https://github.com/fullstorydev/grpcurl/releases/download/v1.8.7/grpcurl_1.8.7_linux_x86_64.tar.gz \
&& tar -xf /bin/grpcurl_1.8.7_linux_x86_64.tar.gz -C /bin \
&& rm -rf /bin/grpcurl_1.8.7_linux_x86_64.tar.gz
RUN pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0
ENV LIBTORCH=/usr/local/lib/python3.8/site-packages/torch
ENV DYLD_LIBRARY_PATH=${LIBTORCH}/lib
ENV LD_LIBRARY_PATH=${LIBTORCH}/lib:$LD_LIBRARY_PATH
ENV LIBTORCH_CXX11_ABI=0
COPY --from=builder /app/algo-rust-bert-demo algo-rust-bert-demo
RUN mkdir resources
COPY ./resources ./resources
CMD ["./algo-rust-bert-demo"]