-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathDockerfile.jetson
119 lines (103 loc) · 3.98 KB
/
Dockerfile.jetson
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
ARG BASE_CONTAINER=hiennguyen9874/jetson-deepstream:deepstream-6.0.1-opencv
FROM $BASE_CONTAINER as base
# Enviroment
ENV SWIG_PATH=/usr/swig/bin
ENV PATH=$SWIG_PATH:$PATH
ENV DEBIAN_FRONTEND=noninteractive
ENV LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libatlas-base-dev libatlas3-base \
clang-8 \
libopenblas-dev \
libpcre2-dev \
flex bison \
&& rm -rf /var/lib/apt/lists/* \
&& apt autoremove \
&& apt-get clean
FROM base as builder
WORKDIR /tmp
RUN wget https://prdownloads.sourceforge.net/swig/swig-4.1.0.tar.gz \
&& tar -xzvf swig-4.1.0.tar.gz \
&& rm swig-4.1.0.tar.gz \
&& cd /tmp/swig-4.1.0 \
&& ./configure --prefix=/usr/swig \
&& make \
&& make install \
&& cd /tmp \
&& rm -rf /tmp/swig-4.1.0
# /usr/swig/
ENV SWIG_PATH=/usr/swig/bin
ENV PATH=$SWIG_PATH:$PATH
WORKDIR /tmp
RUN git clone https://github.com/facebookresearch/faiss.git \
&& cd /tmp/faiss \
&& mkdir build \
&& /cmake/bin/cmake -B build \
# -DCMAKE_CXX_COMPILER=clang++-8 \
-DFAISS_ENABLE_GPU=OFF \
-DFAISS_ENABLE_PYTHON=ON \
-DPython_EXECUTABLE=$(which python3) \
-DFAISS_OPT_LEVEL=generic \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=ON . \
&& make -C build -j faiss \
&& make -C build -j swigfaiss \
&& make -C build install \
&& cd /tmp \
&& mkdir /tmp/faiss-python \
&& cp -r /tmp/faiss/build/faiss /tmp/faiss-python \
&& rm -rf /tmp/faiss
# /usr/local/include/faiss, /usr/local/share/faiss, /usr/local/lib/libfaiss.so
FROM base
COPY --from=builder /usr/swig /usr/swig
COPY --from=builder /usr/local/include/faiss /usr/local/include/faiss
COPY --from=builder /usr/local/share/faiss /usr/local/share/faiss
COPY --from=builder /usr/local/lib/libfaiss.so /usr/local/lib/libfaiss.so
COPY --from=builder /tmp/faiss-python /tmp/faiss-python
WORKDIR /tmp
RUN cd /tmp/faiss-python/faiss/python \
&& python3 -m pip install setuptools \
&& python3 setup.py install \
&& cp /tmp/faiss-python/faiss/python/*.so /usr/local/lib/ \
&& cd /tmp \
&& rm -rf /tmp/faiss-python
# Pytorch
RUN apt-get update && \
apt-get install -y --no-install-recommends \
autoconf bc build-essential g++-8 gcc-8 clang-8 \
lld-8 gettext-base gfortran-8 iputils-ping libbz2-dev \
libc++-dev libcgal-dev libffi-dev libfreetype6-dev libhdf5-dev \
libjpeg-dev liblzma-dev libncurses5-dev libncursesw5-dev libpng-dev \
libreadline-dev libssl-dev libsqlite3-dev libxml2-dev libxslt-dev \
locales moreutils openssl python-openssl \
rsync scons python3-pip libopenblas-dev \
# llvm-8 \
locales \
&& rm -rf /var/lib/apt/lists/* \
&& apt autoremove \
&& apt-get clean
ENV TORCH_INSTALL=https://developer.download.nvidia.cn/compute/redist/jp/v461/pytorch/torch-1.11.0a0+17540c5+nv22.01-cp36-cp36m-linux_aarch64.whl
ENV LD_LIBRARY_PATH=/usr/lib/llvm-8/lib:$LD_LIBRARY_PATH
# Fix scikit-image https://github.com/scikit-image/scikit-image/issues/4705
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools Cython wheel \
&& python3 -m pip install --no-cache-dir aiohttp numpy=='1.19.4' scipy=='1.5.3' \
&& python3 -m pip install --no-cache-dir --upgrade protobuf \
&& python3 -m pip install --no-cache-dir $TORCH_INSTALL \
&& ln -s /usr/include/locale.h /usr/include/xlocale.h \
&& python3 -m pip install --no-cache-dir pycuda six
RUN python3 -m pip install --no-cache-dir scikit-image==0.17.1 matplotlib
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3-tk \
&& rm -rf /var/lib/apt/lists/* \
&& apt autoremove \
&& apt-get clean
WORKDIR /app
COPY ./ /app
CMD [ "./bin/deepstream-app", "-c", "samples/configs/deepstream_app_jetson.txt" ]