#/************************************************************************* # * Copyright (C) [2019] by Cambricon, Inc. All rights reserved # * # * Licensed under the Apache License, Version 2.0 (the "License"); # * you may not use this file except in compliance with the License. # * You may obtain a copy of the License at # * # * http://www.apache.org/licenses/LICENSE-2.0 # * # * The above copyright notice and this permission notice shall be included in # * all copies or substantial portions of the Software. # * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # * THE SOFTWARE. # *************************************************************************/ # 1. build image # (1) build image without cntookit and cnstream: docker build -f Dockerfile.16.04 -t ubuntu16_cnstream:v1 . # (2) build image with cntookit installed and without cnstream: # a. make sure the toolkit_package is in your current directory # b. docker build -f Dockerfile.16.04 --build-arg toolkit_package=${toolkit_package_name} -t ubuntu16_cnstream:v1 . # (3) build image with cntookit installed and with cnstream code built: # a. make sure the toolkit_package is in your current directory # b. docker build -f Dockerfile.16.04 --build-arg toolkit_package=${toolkit_package_name} --build-arg with_cnstream_code=yes -t ubuntu16_cnstream:v1 . # 2. start container: docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --privileged -v /dev:/dev --net=host --ipc=host --pid=host -v $HOME/.Xauthority -it --name container_name -v $PWD:/workspace ubuntu_cnstream:v1 FROM ubuntu:16.04 MAINTAINER ARG toolkit_package="" ARG mlu_platform=MLU220 ARG with_cnstream_code=no RUN echo -e 'nameserver 114.114.114.114' > /etc/resolv.conf RUN sed -i "1i deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe\n deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse\n" /etc/apt/sources.list && \ apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends --fix-missing \ curl git wget vim build-essential cmake make \ libopencv-dev libcurl4-openssl-dev \ libgoogle-glog-dev \ openssh-server librdkafka-dev\ libsdl2-dev \ lcov \ libmysqlclient-dev \ ca-certificates \ net-tools && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* COPY $toolkit_package /tmp/ # install cntookit, git clone cnstream from gitee and build RUN if [ -n "$toolkit_package" ]; then \ dpkg -i /tmp/$toolkit_package && \ apt -o Accquire::AllowInsecureRepositories=true update && \ apt install -y cndev cndrv cnrt cncodec && \ rm -rf /tmp/$toolkit_package; \ if [ "$with_cnstream_code" = "yes" ]; then \ cd /root && git clone https://gitee.com/SolutionSDK/CNStream.git CNStream && \ cd /root/CNStream && mkdir build && cd build &&\ cmake .. -DMLU=$mlu_platform && make -j; \ fi \ fi COPY ./3rdparty/ /root RUN cd /root/ && tar -zxvf ZLToolKit.tar.gz RUN cp -rf /root/ZLToolKit/lib/* /usr/local/lib/ RUN cp -rf /root/ZLToolKit/include/* /usr/local/include/ # install opencv RUN cd /root/ && tar -zxvf opencv.tar.gz RUN cp -rf /root/opencv/lib/* /usr/local/lib/ RUN cp -rf /root/opencv/include/* /usr/local/include/ # install kafka RUN cd /root/ && tar -zxvf kafka.tar.gz RUN cp -rf /root/kafka/lib/* /usr/local/lib/ RUN cp -rf /root/kafka/include/* /usr/local/include/ # install ffmpeg RUN cd /root && tar -zxvf ffmpeg.tar.gz RUN cp -rf /root/ffmpeg/lib/* /usr/local/lib/ RUN cp -rf /root/ffmpeg/include/* /usr/local/include/ # remove RUN rm -rf /root/ZLToolKit* /root/opencv* /root/kafka* /root/ffmpeg* # ffmpeg # libjpeg # libpng WORKDIR /root # dkms