Skip to content

Commit

Permalink
feat: update all docker images to ubuntu 18.04
Browse files Browse the repository at this point in the history
  • Loading branch information
quadeare committed Jun 2, 2020
1 parent c29774c commit eaf0421
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 78 deletions.
8 changes: 5 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cpu.Dockerfile
gpu.Dockerfile
cpu-armv7.Dockerfile
docker/cpu.Dockerfile
docker/cpu-armv7.Dockerfile
docker/gpu.Dockerfile
docker/gpu-xenial.Dockerfile
build/
6 changes: 4 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ where `path/to/volume` is the path to your local volume that you'd like to attac
Dockerfiles are stored in the "docker" folder, but **you must launch build from root directory**.

We choose to prefix Dockerfiles with target architecture :
* cpu-armv7.Dockerfile

* cpu.Dockerfile
* cpu-armv7.Dockerfile
* gpu.Dockerfile
* gpu-xenial.Dockerfile

### Build script

Expand All @@ -139,7 +141,7 @@ Expected values :
* tf-cpu
* caffe-cpu-tf
* caffe-tf
* caffe2
* caffe2 (Only with gpu-xenial.Dockerfile)
* p100
* volta
* volta-faiss
Expand Down
56 changes: 33 additions & 23 deletions docker/cpu-armv7.Dockerfile → docker/cpu-arm.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
FROM armv7/armhf-ubuntu:16.04 AS build
# Default ARM version
ARG ARM_VERSION=arm32v7

FROM ${ARM_VERSION}/ubuntu:18.04 AS build

ARG DEEPDETECT_ARCH=cpu
ARG DEEPDETECT_BUILD=armv7

RUN apt-get update && \
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y git \
build-essential \
cmake \
libgoogle-glog-dev \
libgflags-dev \
libeigen3-dev \
libopencv-dev \
libcppnetlib-dev \
libboost-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libboost-system-dev \
libboost-iostreams-dev \
libboost-program-options-dev \
libboost-test-dev \
libssl-dev \
libcurl4-openssl-dev \
protobuf-compiler \
libopenblas-dev \
Expand All @@ -33,15 +43,15 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Need cmake > 3.10 : https://github.com/jolibrain/ncnn/blob/master/CMakeLists.txt#L14
RUN mkdir /tmp/cmake && cd /tmp/cmake && \
apt remove cmake && \
wget https://cmake.org/files/v3.10/cmake-3.10.3.tar.gz && \
tar xf cmake-3.10.3.tar.gz && \
cd cmake-3.10.3 && \
./configure && \
make install && \
rm -rf /tmp/cmake
# Build cpp-netlib
RUN wget https://github.com/cpp-netlib/cpp-netlib/archive/cpp-netlib-0.11.2-final.tar.gz && \
tar xvzf cpp-netlib-0.11.2-final.tar.gz && \
cd cpp-netlib-cpp-netlib-0.11.2-final && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install

WORKDIR /opt
RUN git clone https://github.com/jpbarrette/curlpp.git
Expand All @@ -64,7 +74,7 @@ RUN mkdir build && \
RUN ./docker/get_libs.sh

# Build final Docker image
FROM armv7/armhf-ubuntu:16.04
FROM ${ARM_VERSION}/ubuntu:18.04

# Copy Deepdetect binaries from previous step
COPY --from=build /opt/deepdetect/build/main /opt/deepdetect/build/main
Expand All @@ -78,18 +88,18 @@ RUN apt-get update && \
libopenblas-base \
liblmdb0 \
libleveldb1v5 \
libboost-regex1.58.0 \
libboost-regex1.62.0 \
libgoogle-glog0v5 \
libopencv-highgui2.4v5 \
libcppnetlib0 \
libgflags2v5 \
libcurl3 \
libhdf5-cpp-11 \
libboost-filesystem1.58.0 \
libboost-thread1.58.0 \
libboost-iostreams1.58.0 \
libopencv-highgui3.2 \
libgflags2.2 \
libcurl4 \
libhdf5-cpp-100 \
libboost-filesystem1.65.1 \
libboost-thread1.65.1 \
libboost-iostreams1.65.1 \
libboost-regex1.65.1 \
libarchive13 \
libprotobuf9v5 && \
libprotobuf10 && \
rm -rf /var/lib/apt/lists/*

# Fix permissions
Expand Down
60 changes: 32 additions & 28 deletions docker/cpu.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
FROM ubuntu:16.04 AS build
FROM ubuntu:18.04 AS build

ARG DEEPDETECT_ARCH=cpu
ARG DEEPDETECT_BUILD=default

# Add gcc7 repository
RUN apt update && \
apt install -y software-properties-common && \
add-apt-repository ppa:ubuntu-toolchain-r/test -y

# Install build dependencies
RUN apt-get update -y && \
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update -y && \
apt-get install -y git \
automake \
cmake \
build-essential \
openjdk-8-jdk \
pkg-config \
Expand All @@ -23,9 +20,14 @@ RUN apt-get update -y && \
libgflags-dev \
libeigen3-dev \
libopencv-dev \
libcppnetlib-dev \
libboost-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libboost-system-dev \
libboost-iostreams-dev \
libboost-program-options-dev \
libboost-test-dev \
libssl-dev \
libcurlpp-dev \
libcurl4-openssl-dev \
protobuf-compiler \
Expand Down Expand Up @@ -58,16 +60,17 @@ RUN apt-get update -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Need cmake > 3.10 : https://github.com/jolibrain/ncnn/blob/master/CMakeLists.txt#L14
RUN mkdir /tmp/cmake && cd /tmp/cmake && \
apt remove cmake && \
wget https://cmake.org/files/v3.10/cmake-3.10.3.tar.gz && \
tar xf cmake-3.10.3.tar.gz && \
cd cmake-3.10.3 && \
./configure && \
make install && \
rm -rf /tmp/cmake
# Build cpp-netlib
RUN wget https://github.com/cpp-netlib/cpp-netlib/archive/cpp-netlib-0.11.2-final.tar.gz && \
tar xvzf cpp-netlib-0.11.2-final.tar.gz && \
cd cpp-netlib-cpp-netlib-0.11.2-final && \
mkdir build && \
cd build && \
cmake .. && \
make && \
make install

# Build curlpp
WORKDIR /opt
RUN git clone https://github.com/jpbarrette/curlpp.git
WORKDIR /opt/curlpp
Expand All @@ -89,7 +92,7 @@ RUN mkdir build && \
RUN ./docker/get_libs.sh

# Build final Docker image
FROM ubuntu:16.04
FROM ubuntu:18.04

# Download default Deepdetect models
ARG DEEPDETECT_DEFAULT_MODELS=true
Expand All @@ -107,18 +110,18 @@ RUN apt-get update && \
libopenblas-base \
liblmdb0 \
libleveldb1v5 \
libboost-regex1.58.0 \
libboost-regex1.62.0 \
libgoogle-glog0v5 \
libopencv-highgui2.4v5 \
libcppnetlib0 \
libgflags2v5 \
libcurl3 \
libhdf5-cpp-11 \
libboost-filesystem1.58.0 \
libboost-thread1.58.0 \
libboost-iostreams1.58.0 \
libopencv-highgui3.2 \
libgflags2.2 \
libcurl4 \
libhdf5-cpp-100 \
libboost-filesystem1.65.1 \
libboost-thread1.65.1 \
libboost-iostreams1.65.1 \
libboost-regex1.65.1 \
libarchive13 \
libprotobuf9v5 && \
libprotobuf10 && \
rm -rf /var/lib/apt/lists/*

# Fix permissions
Expand Down Expand Up @@ -148,3 +151,4 @@ VOLUME ["/data"]
# Set entrypoint
CMD ./dede -host 0.0.0.0
EXPOSE 8080

150 changes: 150 additions & 0 deletions docker/gpu-xenial.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
# Default CUDA version
ARG CUDA_VERSION=9.0-cudnn7

# Download default Deepdetect models
ARG DEEPDETECT_DEFAULT_MODELS=true

FROM nvidia/cuda:${CUDA_VERSION}-devel-ubuntu16.04 AS build

ARG DEEPDETECT_ARCH=gpu
ARG DEEPDETECT_BUILD=default

# Install build dependencies
RUN apt-get update && \
apt-get install -y git \
cmake \
automake \
build-essential \
openjdk-8-jdk \
pkg-config \
zip \
g++ \
zlib1g-dev \
libgoogle-glog-dev \
libgflags-dev \
libeigen3-dev \
libopencv-dev \
libcppnetlib-dev \
libboost-dev \
libboost-iostreams-dev \
libcurlpp-dev \
libcurl4-openssl-dev \
protobuf-compiler \
libopenblas-dev \
libhdf5-dev \
libprotobuf-dev \
libleveldb-dev \
libsnappy-dev \
liblmdb-dev \
libutfcpp-dev \
wget \
autoconf \
libtool-bin \
python-numpy \
swig \
curl \
unzip \
libspdlog-dev \
python-setuptools \
python-dev \
python-wheel \
python-pip \
unzip \
libgoogle-perftools-dev \
curl \
libspdlog-dev \
libarchive-dev \
bash-completion && \
wget -O /tmp/bazel.deb https://github.com/bazelbuild/bazel/releases/download/0.24.1/bazel_0.24.1-linux-x86_64.deb && \
dpkg -i /tmp/bazel.deb && \
apt-get remove -y libcurlpp0 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Fix "ImportError: No module named builtins"
RUN pip install future pyyaml typing six enum enum34

# Git config
RUN git config --global user.email "[email protected]" && \
git config --global user.name "Build"

WORKDIR /opt
RUN git clone https://github.com/jpbarrette/curlpp.git
WORKDIR /opt/curlpp
RUN cmake . && \
make install && \
cp /usr/local/lib/libcurlpp.* /usr/lib/

# Copy Deepdetect sources files
ADD ./ /opt/deepdetect
WORKDIR /opt/deepdetect/

# Build Deepdetect
RUN mkdir build && \
cd build && \
cp -a ../build.sh . && \
./build.sh

# Copy libs to /tmp/libs for next build stage
RUN ./docker/get_libs.sh

# Build final Docker image
FROM nvidia/cuda:${CUDA_VERSION}-runtime-ubuntu16.04

# Download default Deepdetect models
ARG DEEPDETECT_DEFAULT_MODELS=true

# Copy Deepdetect binaries from previous step
COPY --from=build /opt/deepdetect/build/main /opt/deepdetect/build/main
COPY --from=build /opt/deepdetect/get_models.sh /opt/deepdetect/get_models.sh

LABEL maintainer="[email protected]"
LABEL description="DeepDetect deep learning server & API / GPU version"

# Install tools and dependencies
RUN apt-get update && \
apt-get install -y wget \
libopenblas-base \
liblmdb0 \
libleveldb1v5 \
libboost-regex1.58.0 \
libgoogle-glog0v5 \
libopencv-highgui2.4v5 \
libcppnetlib0 \
libgflags2v5 \
libcurl3 \
libhdf5-cpp-11 \
libboost-filesystem1.58.0 \
libboost-thread1.58.0 \
libboost-iostreams1.58.0 \
libarchive13 \
libprotobuf9v5 && \
rm -rf /var/lib/apt/lists/*

# 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 dd:dd /opt
USER dd

# External volume to be mapped, e.g. for models or training data
RUN mkdir /opt/models

# Include a few image models within the image
WORKDIR /opt/models
RUN /opt/deepdetect/get_models.sh

COPY --chown=dd --from=build /opt/deepdetect/datasets/imagenet/corresp_ilsvrc12.txt /opt/models/ggnet/corresp.txt
COPY --chown=dd --from=build /opt/deepdetect/datasets/imagenet/corresp_ilsvrc12.txt /opt/models/resnet_50/corresp.txt
COPY --chown=dd --from=build /opt/deepdetect/templates/caffe/googlenet/*prototxt /opt/models/ggnet/
COPY --chown=dd --from=build /opt/deepdetect/templates/caffe/resnet_50/*prototxt /opt/models/resnet_50/
COPY --from=build /tmp/lib/* /usr/lib/

WORKDIR /opt/deepdetect/build/main
VOLUME ["/data"]

# Set entrypoint
CMD ./dede -host 0.0.0.0
EXPOSE 8080
Loading

0 comments on commit eaf0421

Please sign in to comment.