Skip to content

Commit 756845b

Browse files
committed
feat: add jetson nano docker image
1 parent db17a41 commit 756845b

File tree

3 files changed

+173
-0
lines changed

3 files changed

+173
-0
lines changed

ci/Jenkinsfile.docker

+8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ pipeline {
4242
sh 'ci/build-docker-images.sh gpu_tensorrt'
4343
}
4444
}}
45+
stage('Build docker nano image') { steps {
46+
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE', catchInterruptions: false) {
47+
sh 'echo "DISABLED"'
48+
sh 'it does work, it have the same issue as https://github.com/pytorch/pytorch/issues/39680'
49+
sh 'exit 1'
50+
sh 'ci/build-docker-images.sh nano'
51+
}
52+
}}
4553
stage('Update dockerhub readme') {
4654
when {
4755
expression { BRANCH_NAME == "master" }

ci/build-docker-images.sh

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ TARGETS[gpu]="gpu/default"
1818
TARGETS[gpu_tf]="gpu/tf"
1919
TARGETS[gpu_torch]="gpu/torch"
2020
TARGETS[gpu_tensorrt]="gpu_tensorrt/tensorrt"
21+
TARGETS[nano]="nano/default"
2122

2223
PR_NUMBER=$(echo $GIT_BRANCH | sed -n '/^PR-/s/PR-//gp')
2324
if [ "$TAG_NAME" ]; then
@@ -31,6 +32,9 @@ else
3132
TMP_TAG="trash"
3233
fi
3334

35+
# Setup binfmt to use qemu for arm docker image
36+
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
37+
3438
image_url_prefix="jolibrain/deepdetect"
3539

3640
for name in $NAMES; do

docker/nano.Dockerfile

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# if built on amd64 arch, install these packages to add arm support to docker
2+
# apt install -y qemu binfmt-support qemu-user-static
3+
4+
FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base AS build
5+
6+
ARG DEEPDETECT_DEFAULT_MODELS=true
7+
8+
RUN export DEBIAN_FRONTEND=noninteractive && \
9+
apt-get update -y && apt-get install -y \
10+
wget \
11+
curl \
12+
cmake \
13+
git \
14+
ccache \
15+
automake \
16+
rsync \
17+
build-essential \
18+
pkg-config \
19+
zip \
20+
g++ \
21+
gcc-7 g++-7 \
22+
zlib1g-dev \
23+
protobuf-compiler \
24+
libprotobuf-dev \
25+
libgoogle-glog-dev \
26+
libgflags-dev \
27+
libeigen3-dev \
28+
libopencv-dev \
29+
libboost-dev \
30+
libboost-filesystem-dev \
31+
libboost-thread-dev \
32+
libboost-system-dev \
33+
libboost-stacktrace-dev \
34+
libboost-iostreams-dev \
35+
libboost-program-options-dev \
36+
libboost-test-dev \
37+
libboost-regex-dev \
38+
libboost-date-time-dev \
39+
libboost-chrono-dev \
40+
libssl-dev \
41+
libgtest-dev \
42+
libcurlpp-dev \
43+
libcurl4-openssl-dev \
44+
libopenblas-dev \
45+
libhdf5-dev \
46+
libleveldb-dev \
47+
libsnappy-dev \
48+
liblmdb-dev \
49+
libutfcpp-dev \
50+
rapidjson-dev \
51+
libmapbox-variant-dev \
52+
autoconf \
53+
libtool-bin \
54+
swig \
55+
unzip \
56+
libgoogle-perftools-dev \
57+
libarchive-dev \
58+
bash-completion \
59+
schedtool \
60+
python-numpy \
61+
util-linux
62+
63+
RUN apt clean -y
64+
65+
RUN curl -L https://github.com/Kitware/CMake/releases/download/v3.19.6/cmake-3.19.6-Linux-aarch64.sh -o cmake-install.sh
66+
RUN chmod +x ./cmake-install.sh
67+
RUN ./cmake-install.sh --prefix=/usr/local --skip-license
68+
69+
ADD . /opt/deepdetect
70+
WORKDIR /opt/deepdetect/
71+
72+
ENV CCACHE_DIR=/ccache
73+
#ENV PATH=/usr/lib/ccache:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
74+
75+
# Build Deepdetect
76+
ENV TERM=xterm
77+
RUN mkdir build && cd build && \
78+
cmake .. \
79+
-DBUILD_SPDLOG=ON \
80+
-DBUILD_PROTOBUF=OFF \
81+
-DUSE_HTTP_SERVER_OATPP=ON \
82+
-DUSE_CAFFE=OFF \
83+
-DUSE_TENSORRT=ON \
84+
-DUSE_TENSORRT_OSS=ON \
85+
-DCUDA_ARCH="-gencode arch=compute_62,code=sm_62 -gencode arch=compute_53,code=sm_53" \
86+
-DJETSON=ON && make
87+
88+
# Copy libs to /tmp/libs for next build stage
89+
RUN ./docker/get_libs.sh
90+
91+
# Build final Docker image
92+
FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base AS runtime
93+
94+
LABEL description="DeepDetect deep learning server & API / jetson nano version"
95+
LABEL maintainer="[email protected]"
96+
97+
# Install tools and dependencies
98+
RUN export DEBIAN_FRONTEND=noninteractive && \
99+
apt-get update -y && apt-get install -y \
100+
wget \
101+
curl \
102+
libopenblas-base \
103+
liblmdb0 \
104+
libleveldb1v5 \
105+
libboost-regex1.62.0 \
106+
libgoogle-glog0v5 \
107+
libprotobuf10 \
108+
libopencv3.2 \
109+
libgflags2.2 \
110+
libcurl4 \
111+
libcurlpp0 \
112+
libhdf5-cpp-100 \
113+
libboost-atomic1.65.1 \
114+
libboost-chrono1.65.1 \
115+
libboost-date-time1.65.1 \
116+
libboost-filesystem1.65.1 \
117+
libboost-thread1.65.1 \
118+
libboost-iostreams1.65.1 \
119+
libboost-regex1.65.1 \
120+
libboost-stacktrace1.65.1 \
121+
libboost-system1.65.1 \
122+
libarchive13
123+
124+
# Fix permissions
125+
RUN ln -sf /dev/stdout /var/log/deepdetect.log && \
126+
ln -sf /dev/stderr /var/log/deepdetect.log
127+
128+
RUN useradd -ms /bin/bash dd && \
129+
chown -R dd:dd /opt
130+
USER dd
131+
132+
# Copy Deepdetect binaries from previous step
133+
COPY --from=build /opt/deepdetect/build/main /opt/deepdetect/build/main
134+
COPY --from=build /opt/deepdetect/build/oatpp-swagger/src/oatpp-swagger/res/ /opt/deepdetect/build/oatpp-swagger/src/oatpp-swagger/res/
135+
COPY --from=build --chown=dd /opt/deepdetect/datasets/imagenet/corresp_ilsvrc12.txt /opt/models/ggnet/corresp.txt
136+
COPY --from=build --chown=dd /opt/deepdetect/datasets/imagenet/corresp_ilsvrc12.txt /opt/models/resnet_50/corresp.txt
137+
COPY --from=build --chown=dd /opt/deepdetect/templates/caffe/googlenet/*prototxt /opt/models/ggnet/
138+
COPY --from=build --chown=dd /opt/deepdetect/templates/caffe/resnet_50/*prototxt /opt/models/resnet_50/
139+
COPY --from=build /tmp/lib/* /opt/deepdetect/build/lib/
140+
COPY --from=build /opt/deepdetect/templates /opt/deepdetect/build/templates
141+
142+
COPY --from=build /opt/deepdetect/get_models.sh /opt/deepdetect/
143+
COPY --from=build /opt/deepdetect/docker/check-dede-deps.sh /opt/deepdetect/
144+
COPY --from=build /opt/deepdetect/docker/start-dede.sh /opt/deepdetect/
145+
146+
# External volume to be mapped, e.g. for models or training data
147+
WORKDIR /opt/models
148+
149+
USER root
150+
RUN chown -R dd:dd /opt/models
151+
152+
USER dd
153+
RUN /opt/deepdetect/get_models.sh
154+
155+
# Ensure all libs are presents
156+
RUN /opt/deepdetect/check-dede-deps.sh
157+
158+
WORKDIR /opt/deepdetect/build/main
159+
CMD /opt/deepdetect/start-dede.sh -host 0.0.0.0
160+
VOLUME ["/data"]
161+
EXPOSE 8080

0 commit comments

Comments
 (0)