|
| 1 | +# Dockerfile |
| 2 | + |
| 3 | +# docker build . |
| 4 | + |
| 5 | +# Based on CUDA10.0 & CuDNN7 |
| 6 | +FROM nvidia/cuda:10.2-cudnn8-devel-ubuntu18.04 |
| 7 | + |
| 8 | +# Set apt-get to automatically retry if a package download fails |
| 9 | +RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/99AcquireRetries |
| 10 | + |
| 11 | +# apt update |
| 12 | +RUN apt update --allow-unauthenticated |
| 13 | + |
| 14 | +# Install Non-GPU Dependencies. |
| 15 | +RUN version="8.0.0-1+cuda10.2" ; \ |
| 16 | + apt install -y \ |
| 17 | + libnvinfer8=${version} libnvonnxparsers8=${version} libnvparsers8=${version} \ |
| 18 | + libnvinfer-plugin8=${version} libnvinfer-dev=${version} libnvonnxparsers-dev=${version} \ |
| 19 | + libnvparsers-dev=${version} libnvinfer-plugin-dev=${version} && \ |
| 20 | + apt-mark hold \ |
| 21 | + libnvinfer8 libnvonnxparsers8 libnvparsers8 libnvinfer-plugin8 libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev |
| 22 | +# && apt install -yt python-libnvinfer=${version} python3-libnvinfer=${version} && apt-mark hold python-libnvinfer python3-libnvinfer |
| 23 | + |
| 24 | +# Install OpenCV Dependencies |
| 25 | +RUN apt install -y software-properties-common || apt install -y software-properties-common && \ |
| 26 | + add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" && \ |
| 27 | + APT_DEPS="git cmake wget zip libgtk-3-dev libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev x264 v4l-utils python3-dev python3-pip libcanberra-gtk-module libcanberra-gtk3-module" && \ |
| 28 | + apt install -y $APT_DEPS || apt install -y $APT_DEPS && \ |
| 29 | + python3 -m pip install numpy |
| 30 | + |
| 31 | +# Compile OpenCV |
| 32 | +RUN wget https://github.com/opencv/opencv/archive/refs/tags/4.4.0.zip && unzip 4.4.0.zip && \ |
| 33 | + cd opencv-4.4.0 && mkdir build && cd build && \ |
| 34 | + cmake .. -DCMAKE_BUILD_TYPE=Release \ |
| 35 | + -DCMAKE_INSTALL_PREFIX=/usr/local \ |
| 36 | + -DWITH_TBB=ON \ |
| 37 | + -DWITH_V4L=ON \ |
| 38 | + -DBUILD_TESTS=OFF \ |
| 39 | + -DBUILD_OPENCV_PYTHON3=OFF && \ |
| 40 | + make -j && make install |
| 41 | + |
| 42 | +# Install HyperPose Dependencies |
| 43 | +RUN apt install -y python3-dev python3-pip subversion libgflags-dev |
| 44 | + |
| 45 | +COPY . /hyperpose |
| 46 | + |
| 47 | +# Get models: we first see if there's existing models here. If not install it throught network. |
| 48 | +# NOTE: if you cannot install the models due to network issues: |
| 49 | +# 1 Manually install ONNX and UFF models through: https://drive.google.com/drive/folders/1w9EjMkrjxOmMw3Rf6fXXkiv_ge7M99jR |
| 50 | +# 2 Put all models into `${GIT_DIR}/pre_installed_models` |
| 51 | +# 3 Re-build this docker image. |
| 52 | +RUN ( [ `find /hyperpose/pre_installed_models -regex '.*\.\(onnx\|uff\)' | wc -l` > 0 ] && \ |
| 53 | + mkdir -p /hyperpose/data && mv /hyperpose/pre_installed_models/ /hyperpose/data/models ) || \ |
| 54 | + for file in $(find /hyperpose/scripts -type f -iname 'download-*-model.sh'); do sh $file; done |
| 55 | + |
| 56 | +# Install test data. |
| 57 | +RUN /hyperpose/scripts/download-test-data.sh |
| 58 | + |
| 59 | +# Build Repo |
| 60 | +RUN cd hyperpose && mkdir build && cd build && \ |
| 61 | + cmake .. -DCMAKE_BUILD_TYPE=Release && make -j |
| 62 | + |
| 63 | +WORKDIR /hyperpose/build |
| 64 | + |
| 65 | +ENTRYPOINT ["./hyperpose-cli"] |
0 commit comments