-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (46 loc) · 1.94 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
FROM rust:latest as rustBuilder
RUN USER=root cargo new --bin enso-darknet
WORKDIR /enso-darknet
RUN apt-get update \
&& apt-get install -y cmake libclang-dev gcc libc-bin libc-dev-bin libc6 python3 python3-dev \
&& apt-get install -y tini \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf ./src
##
## Download libtorch binaries
##
RUN wget https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu118.zip \
&& unzip libtorch-cxx11-abi-shared-with-deps-2.0.1+cu118.zip \
&& rm -f libtorch-cxx11-abi-shared-with-deps-2.0.1+cu118.zip
#RUN wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcpu.zip \
# && unzip ./libtorch-cxx11-abi-shared-with-deps-2.0.1+cpu.zip \
# && rm -f ./libtorch-cxx11-abi-shared-with-deps-2.0.1+cpu.zip
ENV LIBTORCH=/enso-darknet/libtorch
ARG LIBTORCH=/enso-darknet/libtorch
COPY ./Cargo.toml ./Cargo.toml
COPY ./src ./src
COPY ./gui ./gui
ENV LD_LIBRARY_PATH=${LIBTORCH}/lib:${LD_LIBRARY_PATH}
ENV DEP_TCH_LIBTORCH_LIB=${LIBTORCH}/lib
ENV PATH=/enso-darknet:${PATH}
RUN cp /usr/bin/python3 /usr/bin/python
RUN \
cargo build --release \
&& cp /enso-darknet/target/release/enso-darknet ./enso-darknet \
&& cp /enso-darknet/target/release/sd-cli ./sd-cli \
&& cp /enso-darknet/target/release/sd-worker ./sd-worker
# cleanup resources needed for rebuild only
# NOT FOR CANDLE FEATURE !
RUN cargo clean \
&& rm -rf ${CARGO_HOME}/registry/* \
&& rm -rf /enso-darknet/libtorch/include
COPY ./download-weights.sh ./download-weights.sh
COPY ./data ./data
COPY ./media ./media
# dowload all weights, 1 worker and API server
CMD ./download-weights.sh && (./sd-worker & ./enso-darknet)
# CANDLE FEATURE BUILD AND RUN on cloud side (with GPU installed)
#CMD \
# cargo build --release --no-default-features --features candle \
# && cp /enso-darknet/target/release/candle-sd-worker ./candle-sd-worker \
# && ./candle-sd-worker