-
Notifications
You must be signed in to change notification settings - Fork 561
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
173 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
# if built on amd64 arch, install these packages to add arm support to docker | ||
# apt install -y qemu binfmt-support qemu-user-static | ||
|
||
FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base AS build | ||
|
||
ARG DEEPDETECT_DEFAULT_MODELS=true | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update -y && apt-get install -y \ | ||
wget \ | ||
curl \ | ||
cmake \ | ||
git \ | ||
ccache \ | ||
automake \ | ||
rsync \ | ||
build-essential \ | ||
pkg-config \ | ||
zip \ | ||
g++ \ | ||
gcc-7 g++-7 \ | ||
zlib1g-dev \ | ||
protobuf-compiler \ | ||
libprotobuf-dev \ | ||
libgoogle-glog-dev \ | ||
libgflags-dev \ | ||
libeigen3-dev \ | ||
libopencv-dev \ | ||
libboost-dev \ | ||
libboost-filesystem-dev \ | ||
libboost-thread-dev \ | ||
libboost-system-dev \ | ||
libboost-stacktrace-dev \ | ||
libboost-iostreams-dev \ | ||
libboost-program-options-dev \ | ||
libboost-test-dev \ | ||
libboost-regex-dev \ | ||
libboost-date-time-dev \ | ||
libboost-chrono-dev \ | ||
libssl-dev \ | ||
libgtest-dev \ | ||
libcurlpp-dev \ | ||
libcurl4-openssl-dev \ | ||
libopenblas-dev \ | ||
libhdf5-dev \ | ||
libleveldb-dev \ | ||
libsnappy-dev \ | ||
liblmdb-dev \ | ||
libutfcpp-dev \ | ||
rapidjson-dev \ | ||
libmapbox-variant-dev \ | ||
autoconf \ | ||
libtool-bin \ | ||
swig \ | ||
unzip \ | ||
libgoogle-perftools-dev \ | ||
libarchive-dev \ | ||
bash-completion \ | ||
schedtool \ | ||
python-numpy \ | ||
util-linux | ||
|
||
RUN apt clean -y | ||
|
||
RUN curl -L https://github.com/Kitware/CMake/releases/download/v3.19.6/cmake-3.19.6-Linux-aarch64.sh -o cmake-install.sh | ||
RUN chmod +x ./cmake-install.sh | ||
RUN ./cmake-install.sh --prefix=/usr/local --skip-license | ||
|
||
ADD . /opt/deepdetect | ||
WORKDIR /opt/deepdetect/ | ||
|
||
ENV CCACHE_DIR=/ccache | ||
#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 | ||
|
||
# Build Deepdetect | ||
ENV TERM=xterm | ||
RUN mkdir build && cd build && \ | ||
cmake .. \ | ||
-DBUILD_SPDLOG=ON \ | ||
-DBUILD_PROTOBUF=OFF \ | ||
-DUSE_HTTP_SERVER_OATPP=ON \ | ||
-DUSE_CAFFE=OFF \ | ||
-DUSE_TENSORRT=ON \ | ||
-DUSE_TENSORRT_OSS=ON \ | ||
-DCUDA_ARCH="-gencode arch=compute_62,code=sm_62 -gencode arch=compute_53,code=sm_53" \ | ||
-DJETSON=ON && make | ||
|
||
# Copy libs to /tmp/libs for next build stage | ||
RUN ./docker/get_libs.sh | ||
|
||
# Build final Docker image | ||
FROM nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base AS runtime | ||
|
||
LABEL description="DeepDetect deep learning server & API / jetson nano version" | ||
LABEL maintainer="[email protected]" | ||
|
||
# Install tools and dependencies | ||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update -y && apt-get install -y \ | ||
wget \ | ||
curl \ | ||
libopenblas-base \ | ||
liblmdb0 \ | ||
libleveldb1v5 \ | ||
libboost-regex1.62.0 \ | ||
libgoogle-glog0v5 \ | ||
libprotobuf10 \ | ||
libopencv3.2 \ | ||
libgflags2.2 \ | ||
libcurl4 \ | ||
libcurlpp0 \ | ||
libhdf5-cpp-100 \ | ||
libboost-atomic1.65.1 \ | ||
libboost-chrono1.65.1 \ | ||
libboost-date-time1.65.1 \ | ||
libboost-filesystem1.65.1 \ | ||
libboost-thread1.65.1 \ | ||
libboost-iostreams1.65.1 \ | ||
libboost-regex1.65.1 \ | ||
libboost-stacktrace1.65.1 \ | ||
libboost-system1.65.1 \ | ||
libarchive13 | ||
|
||
# Fix permissions | ||
RUN ln -sf /dev/stdout /var/log/deepdetect.log && \ | ||
ln -sf /dev/stderr /var/log/deepdetect.log | ||
|
||
RUN useradd -ms /bin/bash dd && \ | ||
chown -R dd:dd /opt | ||
USER dd | ||
|
||
# Copy Deepdetect binaries from previous step | ||
COPY --from=build /opt/deepdetect/build/main /opt/deepdetect/build/main | ||
COPY --from=build /opt/deepdetect/build/oatpp-swagger/src/oatpp-swagger/res/ /opt/deepdetect/build/oatpp-swagger/src/oatpp-swagger/res/ | ||
COPY --from=build --chown=dd /opt/deepdetect/datasets/imagenet/corresp_ilsvrc12.txt /opt/models/ggnet/corresp.txt | ||
COPY --from=build --chown=dd /opt/deepdetect/datasets/imagenet/corresp_ilsvrc12.txt /opt/models/resnet_50/corresp.txt | ||
COPY --from=build --chown=dd /opt/deepdetect/templates/caffe/googlenet/*prototxt /opt/models/ggnet/ | ||
COPY --from=build --chown=dd /opt/deepdetect/templates/caffe/resnet_50/*prototxt /opt/models/resnet_50/ | ||
COPY --from=build /tmp/lib/* /opt/deepdetect/build/lib/ | ||
COPY --from=build /opt/deepdetect/templates /opt/deepdetect/build/templates | ||
|
||
COPY --from=build /opt/deepdetect/get_models.sh /opt/deepdetect/ | ||
COPY --from=build /opt/deepdetect/docker/check-dede-deps.sh /opt/deepdetect/ | ||
COPY --from=build /opt/deepdetect/docker/start-dede.sh /opt/deepdetect/ | ||
|
||
# External volume to be mapped, e.g. for models or training data | ||
WORKDIR /opt/models | ||
|
||
USER root | ||
RUN chown -R dd:dd /opt/models | ||
|
||
USER dd | ||
RUN /opt/deepdetect/get_models.sh | ||
|
||
# Ensure all libs are presents | ||
RUN /opt/deepdetect/check-dede-deps.sh | ||
|
||
WORKDIR /opt/deepdetect/build/main | ||
CMD /opt/deepdetect/start-dede.sh -host 0.0.0.0 | ||
VOLUME ["/data"] | ||
EXPOSE 8080 |