diff --git a/core/general-server/op/general_reader_op.cpp b/core/general-server/op/general_reader_op.cpp index 17a1aaa602422062e4426ea25876e73fcb21202a..4b4e25cb075f56449359f7af0c064fcb83c2dd07 100644 --- a/core/general-server/op/general_reader_op.cpp +++ b/core/general-server/op/general_reader_op.cpp @@ -157,15 +157,13 @@ int GeneralReaderOp::inference() { } // implement lod tensor here // only support 1-D lod - // TODO:support 2-D lod + // TODO(HexToString): support 2-D lod if (tensor.lod_size() > 0) { VLOG(2) << "(logid=" << log_id << ") var[" << i << "] is lod_tensor"; lod_tensor.lod.resize(1); for (int k = 0; k < tensor.lod_size(); ++k) { lod_tensor.lod[0].push_back(tensor.lod(k)); } - VLOG(2) << "(logid=" << log_id << ") var[" << i - << "] has lod_tensor and len=" << out->at(i).lod[0].back(); } for (int k = 0; k < tensor.shape_size(); ++k) { @@ -180,7 +178,10 @@ int GeneralReaderOp::inference() { << "]: " << data_len; databuf_size[i] = data_len * elem_size[i]; out->at(i).data.Resize(data_len * elem_size[i]); - + if (out->at(i).lod.size() > 0) { + VLOG(2) << "(logid=" << log_id << ") var[" << i + << "] has lod_tensor and len=" << out->at(i).lod[0].back(); + } if (elem_type[i] == P_INT64) { int64_t *dst_ptr = static_cast(out->at(i).data.data()); VLOG(2) << "(logid=" << log_id << ") first element data in var[" << i diff --git a/doc/PADDLE_SERVING_ON_KUBERNETES.md b/doc/PADDLE_SERVING_ON_KUBERNETES.md new file mode 100644 index 0000000000000000000000000000000000000000..21f4854c035b2d84f544a8c44721c64d945d1d59 --- /dev/null +++ b/doc/PADDLE_SERVING_ON_KUBERNETES.md @@ -0,0 +1,267 @@ +## 在Kubenetes集群上部署Paddle Serving + +Paddle Serving在0.6.0版本开始支持在Kubenetes集群上部署,并提供反向代理和安全网关支持。与Paddle Serving在Docker镜像中开发类似,Paddle Serving 模型在Kubenetes集群部署需要制作轻量化的运行镜像,并使用kubectl工具在集群上部署。 + +### 集群准备 + +如果您还没有Kubenetes集群,我们推荐[购买并使用百度智能云CCE集群](). 如果是其他云服务商提供的集群,或者自行安装Kubenetes集群,请遵照对应的教程。 + +您还需要准备一个用于Kubenetes集群部署使用的镜像仓库,通常与云服务提供商绑定,如果您使用的是百度智能云的CCE集群,可以参照[百度智能云CCR镜像仓库使用方式]()。当然Docker Hub也可以作为镜像仓库,但是可能在部署时会出现下载速度慢的情况。 + +### 环境准备 + +需要在Kubenetes集群上安装网关工具KONG。 + +``` +kubectl apply -f https://bit.ly/kong-ingress-dbless +``` + + + +### 制作Serving运行镜像(可选): + +首先您需要确定运行镜像的具体环境。和[DOCKER开发镜像列表]()文档相比,开发镜像用于调试、编译代码,携带了大量的开发工具,因此镜像体积较大。运行镜像通常要求缩小容器体积以提高部署的灵活性。如果您不太需要轻量级的运行容器,请直接跳过这一部分。 + +在`tools/generate_runtime_docker.sh`文件下,它的使用方式如下 + +```bash +bash tool/generate_runtime_docker.sh --env cuda10.1 --python 2.7 --serving 0.5.0 --paddle 2.0.0 --name serving_runtime:cuda10.1-py27 +``` + +会生成 cuda10.1,python 2.7,serving版本0.5.0 还有 paddle版本2.0.0的运行镜像。如果有其他疑问,可以执行下列语句得到帮助信息。 + +``` +bash tools/generate_runtime_docker.sh --help +``` + +运行镜像会携带以下组建在运行镜像中 + +- paddle-serving-server, paddle-serving-client,paddle-serving-app,paddlepaddle,具体版本可以在tools/runtime.dockerfile当中查看,同时,如果有定制化的需求,也可以在该文件中进行定制化。 +- paddle-serving-server 二进制可执行程序 + +也就是说,运行镜像在生成之后,我们只需要将我们运行的代码(如果有)和模型搬运到镜像中就可以。生成后的镜像名为`paddle_serving:cuda10.2-py37` + +### 添加您的代码和模型 + +在刚才镜像的基础上,我们需要先收集好运行文件。这取决于您是如何使用PaddleServing的 + +#### Pipeline模式: + +对于pipeline模式,我们需要确保模型和程序文件、配置文件等各种依赖都能够在镜像中运行。因此可以在`/home/project`下存放我们的执行文件时,我们以`Serving/python/example/pipeline/ocr`为例,这是OCR文字识别任务。 + +```bash +#假设您已经拥有Serving运行镜像,假设镜像名为paddle_serving:cuda10.2-py37 +docker run --rm -dit --name pipeline_serving_demo paddle_serving:cuda10.2-py37 bash +cd Serving/python/example/pipeline/ocr +# get models +python -m paddle_serving_app.package --get_model ocr_rec +tar -xzvf ocr_rec.tar.gz +python -m paddle_serving_app.package --get_model ocr_det +tar -xzvf ocr_det.tar.gz +cd .. + +docker cp ocr pipeline_serving_demo:/home/ +docker commit pipeline_serving_demo ocr_serving:latest +``` + +其中容器名`paddle_serving_demo`和最终的镜像名`ocr_serving:latest`都可以自行定义,最终通过`docker push`来推到云端的镜像仓库。至此,部署前的最后一步工作已完成。 + +**提示:如果您对runtime镜像是否可运行需要验证,可以执行** + +``` +docker exec -it pipeline_serving_demo bash +cd /home/ocr +python3.7 web_service.py +``` + +进入容器到工程目录之后,剩下的操作和调试代码的工作是类似的。 + +**为了方便您对照,我们也提供了示例镜像registry.baidubce.com/paddlepaddle/serving:k8s-pipeline-demo** + +#### WebService模式: + +web service模式本质上和pipeline模式类似,因此我们以`Serving/python/examples/bert`为例 + +```bash +#假设您已经拥有Serving运行镜像,假设镜像名为registry.baidubce.com/paddlepaddle/serving:0.6.0-cuda10.2-py37 +docker run --rm -dit --name webservice_serving_demo registry.baidubce.com/paddlepaddle/serving:0.6.0-cpu-py27 bash +cd Serving/python/examples/bert +### download model +wget https://paddle-serving.bj.bcebos.com/paddle_hub_models/text/SemanticModel/bert_chinese_L-12_H-768_A-12.tar.gz +tar -xzf bert_chinese_L-12_H-768_A-12.tar.gz +mv bert_chinese_L-12_H-768_A-12_model bert_seq128_model +mv bert_chinese_L-12_H-768_A-12_client bert_seq128_client +sh get_data.sh +cd .. +docker cp bert webservice_serving_demo:/home/ +docker commit webservice_serving_demo bert_serving:latest +``` + +**提示:如果您对runtime镜像是否可运行需要验证,可以执行** + +```bash +docker exec -it webservice_serving_demo bash +cd /home/bert +python3.7 bert_web_service.py 9292 +``` + +进入容器到工程目录之后,剩下的操作和调试代码的工作是类似的。 + +**为了方便您对照,我们也提供了示例镜像registry.baidubce.com/paddlepaddle/serving:k8s-web-demo** + + + +### 在Kubenetes集群上部署 + +kubenetes集群操作需要`kubectl`去操纵yaml文件。我们这里给出了三个部署的例子,他们分别是 + +- pipeline ocr示例 + +```bash +sh tools/generate_k8s_yamls.sh --app_name ocr --image_name registry.baidubce.com/paddlepaddle/serving:k8s-pipeline-demo --workdir /home/ocr --command "python2.7 web_service.py" --port 9999 +``` + +- web service bert示例 + +```bash +sh tools/generate_k8s_yamls.sh --app_name bert --image_name registry.baidubce.com/paddlepaddle/serving:k8s-web-demo --workdir /home/bert --command "python2.7 bert_web_service.py 9292" --port 9292 +``` + +接下来我们会看到有两个yaml文件,分别是`k8s_serving.yaml`和 k8s_ingress.yaml`. + +为减少大家的阅读时间,我们只选择以pipeline为例。 + +```yaml +#k8s_serving.yaml +apiVersion: v1 +kind: Service +metadata: + labels: + app: ocr + name: ocr +spec: + ports: + - port: 18080 + name: http + protocol: TCP + targetPort: 18080 + selector: + app: ocr +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: ocr + name: ocr +spec: + replicas: 1 + selector: + matchLabels: + app: ocr + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + app: ocr + spec: + containers: + - image: registry.baidubce.com/paddlepaddle/serving:k8s-pipeline-demo + name: ocr + ports: + - containerPort: 18080 + workingDir: /home/ocr + name: ocr + command: ['/bin/bash', '-c'] + args: ["python3.7 web_service.py"] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + resources: {} +``` + +```yaml +#kong_api.yaml +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ocr + annotations: + kubernetes.io/ingress.class: kong +spec: + rules: + - http: + paths: + - path: /ocr + backend: + serviceName: ocr + servicePort: 18080 +``` + +最终我们执行就可以启动相关容器和API网关。 + +``` +kubectl apply -f k8s_serving.yaml k8s_ingress.yaml +``` + +输入 + +``` +kubectl get deploy +``` + +可见 + +``` +NAME READY UP-TO-DATE AVAILABLE AGE +ocr 1/1 1 1 2d20h +``` + +我们使用 + +``` +kubectl get service --all-namespaces +``` + +可以看到 + +``` +NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE +default bert ClusterIP 172.16.86.12 9292/TCP 20m +default kubernetes ClusterIP 172.16.0.1 443/TCP 28d +default ocr ClusterIP 172.16.152.43 9999/TCP 50m +kong kong-proxy LoadBalancer 172.16.88.132 80:8893/TCP,443:8805/TCP 25d +kong kong-validation-webhook ClusterIP 172.16.38.100 443/TCP 25d +kube-system heapster ClusterIP 172.16.240.64 80/TCP 28d +kube-system kube-dns ClusterIP 172.16.0.10 53/UDP,53/TCP,9153/TCP 28d +kube-system metrics-server ClusterIP 172.16.34.157 443/TCP 28d +``` + +访问的方式就在 + +```: +http://${KONG_IP}:80/${APP_NAME}/prediction +``` + +例如Bert + +``` +curl -H "Content-Type:application/json" -X POST -d '{"feed":[{"words": "hello"}], "fetch":["pooled_output"]}' http://172.16.88.132:80/bert/prediction +``` + +就会从KONG的网关转发给bert服务。同理,OCR服务也可以把对应的IP地址换成`http://172.16.88.132:80/ocr/prediction` diff --git a/python/paddle_serving_client/client.py b/python/paddle_serving_client/client.py index 8f1218b84d892069cb21a6c56406b66bd8f6c26a..48ad112ab015242b85753489f84422c4187f6ec1 100755 --- a/python/paddle_serving_client/client.py +++ b/python/paddle_serving_client/client.py @@ -555,7 +555,14 @@ class MultiLangClient(object): ) resp = self.stub_.GetClientConfig(get_client_config_req) model_config_path_list = resp.client_config_str_list - self._parse_model_config(model_config_path_list) + file_path_list = [] + for single_model_config in model_config_path_list: + if os.path.isdir(single_model_config): + file_path_list.append("{}/serving_server_conf.prototxt".format( + single_model_config)) + elif os.path.isfile(single_model_config): + file_path_list.append(single_model_config) + self._parse_model_config(file_path_list) def _flatten_list(self, nested_list): for item in nested_list: diff --git a/python/paddle_serving_server/rpc_service.py b/python/paddle_serving_server/rpc_service.py index f41a4e2422db52fc79f155270487ce2f0363ec9e..d9d302831fd2e3148547e24772005efb38cb8f32 100755 --- a/python/paddle_serving_server/rpc_service.py +++ b/python/paddle_serving_server/rpc_service.py @@ -34,11 +34,18 @@ class MultiLangServerServiceServicer(multi_lang_general_model_service_pb2_grpc. self._parse_model_config(self.model_config_path_list) def _init_bclient(self, model_config_path_list, endpoints, timeout_ms=None): + file_path_list = [] + for single_model_config in model_config_path_list: + if os.path.isdir(single_model_config): + file_path_list.append("{}/serving_server_conf.prototxt".format( + single_model_config)) + elif os.path.isfile(single_model_config): + file_path_list.append(single_model_config) from paddle_serving_client import Client self.bclient_ = Client() if timeout_ms is not None: self.bclient_.set_rpc_timeout_ms(timeout_ms) - self.bclient_.load_client_config(model_config_path_list) + self.bclient_.load_client_config(file_path_list) self.bclient_.connect(endpoints) def _parse_model_config(self, model_config_path_list): diff --git a/tools/Dockerfile b/tools/Dockerfile deleted file mode 100644 index ab83229af56c65cb9505b524eb08fe5ce2931a5b..0000000000000000000000000000000000000000 --- a/tools/Dockerfile +++ /dev/null @@ -1,187 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:9.0-cudnn7-devel-ubuntu16.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev - -RUN apt-get update && \ - apt-get install -y --allow-downgrades --allow-change-held-packages \ - patchelf git python-pip python-dev python-opencv openssh-server bison \ - wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ - curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ - automake locales clang-format swig \ - liblapack-dev liblapacke-dev libcurl4-openssl-dev \ - net-tools libtool module-init-tools vim && \ - apt-get clean -y - -RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so.10 && \ - ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/libcrypto.so.10 - -RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -O shellcheck-v0.7.1.linux.x86_64.tar.xz && \ - tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz && cp shellcheck-v0.7.1/shellcheck /usr/bin/shellcheck && \ - rm -rf shellcheck-v0.7.1.linux.x86_64.tar.xz shellcheck-v0.7.1 - -# Downgrade gcc&&g++ -WORKDIR /usr/bin - COPY tools/dockerfile/build_scripts /build_scripts - RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts - RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ - ENV PATH=/usr/local/gcc-8.2/bin:$PATH - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.7 -RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ - tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.8 -RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ - tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. -ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -RUN apt-get install libprotobuf-dev -y - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. -RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ - dpkg -i patchelf_0.10-2_amd64.deb - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -CMD source ~/.bashrc - -# ccache 3.7.9 -RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ - tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ - ./configure -prefix=/usr/local/ccache-3.7.9 && \ - make -j8 && make install && \ - ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache - -RUN python3.8 -m pip install --upgrade pip requests && \ - python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.centos6.cuda9.0-cudnn7.devel b/tools/Dockerfile.centos6.cuda9.0-cudnn7.devel deleted file mode 100644 index eddd7e8b912b4cd2bb19f558413ffec1aea58071..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.centos6.cuda9.0-cudnn7.devel +++ /dev/null @@ -1,55 +0,0 @@ -FROM nvidia/cuda:9.0-cudnn7-devel-centos6 - -RUN yum -y install wget && \ - wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtoolset-2.repo && \ - yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils && \ - source /opt/rh/devtoolset-2/enable && \ - echo 'source /opt/rh/devtoolset-2/enable' >> /root/.bashrc && \ - yum -y install git openssl-devel curl-devel bzip2-devel && \ - wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz && \ - tar xzf cmake-3.2.0-Linux-x86_64.tar.gz && \ - mv cmake-3.2.0-Linux-x86_64 /usr/local/cmake3.2.0 && \ - echo 'export PATH=/usr/local/cmake3.2.0/bin:$PATH' >> /root/.bashrc && \ - rm cmake-3.2.0-Linux-x86_64.tar.gz && \ - wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz && \ - tar xzf go1.14.linux-amd64.tar.gz && \ - mv go /usr/local/go && \ - echo 'export GOROOT=/usr/local/go' >> /root/.bashrc && \ - echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc && \ - rm go1.14.linux-amd64.tar.gz && \ - yum -y install python-devel sqlite-devel && \ - wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz && \ - tar -zxf Python-2.7.5.tgz && \ - cd Python-2.7.5 && \ - ./configure --prefix=/usr/local/python2.7 --enable-shared --enable-unicode=ucs4 && \ - make all && make install && \ - make clean && \ - echo 'export PATH=/usr/local/python2.7/bin:$PATH' >> /root/.bashrc && \ - echo 'export LD_LIBRARY_PATH=/usr/local/python2.7/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \ - cd .. && rm -rf Python-2.7.5* && \ - source /root/.bashrc && \ - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ - python get-pip.py && \ - rm get-pip.py && \ - wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz && \ - tar -zxf Python-3.6.8.tgz && \ - cd Python-3.6.8 && \ - ./configure --prefix=/usr/local/python3.6 --enable-shared && \ - make all && make install && \ - make clean && \ - echo 'export PATH=/usr/local/python3.6/bin:$PATH' >> /root/.bashrc && \ - echo 'export LD_LIBRARY_PATH=/usr/local/python3.6/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \ - pip install requests && \ - pip3 install requests && \ - source /root/.bashrc && \ - cd .. && rm -rf Python-3.6.8* && \ - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protobuf-all-3.11.2.tar.gz && \ - tar zxf protobuf-all-3.11.2.tar.gz && \ - cd protobuf-3.11.2 && \ - ./configure && make -j4 && make install && \ - make clean && \ - cd .. && rm -rf protobuf-* &&\ - yum -y install epel-release && yum -y install patchelf libXext libSM libXrender && \ - yum clean all && \ - echo "export LANG=en_US.utf8" >> /root/.bashrc && \ - echo "export LANGUAGE=en_US.utf8" >> /root/.bashrc diff --git a/tools/Dockerfile.centos6.devel b/tools/Dockerfile.centos6.devel deleted file mode 100644 index d0a4559ca29a22a8eb6627d19eb5e2f641ac37ec..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.centos6.devel +++ /dev/null @@ -1,56 +0,0 @@ -FROM centos:6 - -RUN yum -y install wget && \ - wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtoolset-2.repo && \ - yum -y install devtoolset-2-gcc devtoolset-2-gcc-c++ devtoolset-2-binutils && \ - source /opt/rh/devtoolset-2/enable && \ - echo 'source /opt/rh/devtoolset-2/enable' >> /root/.bashrc && \ - yum -y install git openssl-devel curl-devel bzip2-devel && \ - wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz && \ - tar xzf cmake-3.2.0-Linux-x86_64.tar.gz && \ - mv cmake-3.2.0-Linux-x86_64 /usr/local/cmake3.2.0 && \ - echo 'export PATH=/usr/local/cmake3.2.0/bin:$PATH' >> /root/.bashrc && \ - rm cmake-3.2.0-Linux-x86_64.tar.gz && \ - wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz && \ - tar xzf go1.14.linux-amd64.tar.gz && \ - mv go /usr/local/go && \ - echo 'export GOROOT=/usr/local/go' >> /root/.bashrc && \ - echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc && \ - rm go1.14.linux-amd64.tar.gz && \ - yum -y install python-devel sqlite-devel && \ - wget https://www.python.org/ftp/python/2.7.5/Python-2.7.5.tgz && \ - tar -zxf Python-2.7.5.tgz && \ - cd Python-2.7.5 && \ - ./configure --prefix=/usr/local/python2.7 --enable-shared --enable-unicode=ucs4 && \ - make all && make install && \ - make clean && \ - echo 'export PATH=/usr/local/python2.7/bin:$PATH' >> /root/.bashrc && \ - echo 'export LD_LIBRARY_PATH=/usr/local/python2.7/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \ - cd .. && rm -rf Python-2.7.5* && \ - source /root/.bashrc && \ - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \ - python get-pip.py && \ - rm get-pip.py && \ - wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz && \ - tar -zxf Python-3.6.8.tgz && \ - cd Python-3.6.8 && \ - ./configure --prefix=/usr/local/python3.6 --enable-shared && \ - make all && make install && \ - make clean && \ - echo 'export PATH=/usr/local/python3.6/bin:$PATH' >> /root/.bashrc && \ - echo 'export LD_LIBRARY_PATH=/usr/local/python3.6/lib:$LD_LIBRARY_PATH' >> /root/.bashrc && \ - source /root/.bashrc && \ - cd .. && rm -rf Python-3.6.8* && \ - wget https://github.com/protocolbuffers/protobuf/releases/download/v3.11.2/protobuf-all-3.11.2.tar.gz && \ - tar zxf protobuf-all-3.11.2.tar.gz && \ - cd protobuf-3.11.2 && \ - ./configure && make -j4 && make install && \ - make clean && \ - cd .. && rm -rf protobuf-* && \ - yum -y install epel-release && yum -y install patchelf libXext libSM libXrender && \ - yum clean all && \ - pip install requests && \ - pip3 install requests && \ - localedef -c -i en_US -f UTF-8 en_US.UTF-8 && \ - echo "export LANG=en_US.utf8" >> /root/.bashrc && \ - echo "export LANGUAGE=en_US.utf8" >> /root/.bashrc diff --git a/tools/Dockerfile.cuda10.0-cudnn7 b/tools/Dockerfile.cuda10.0-cudnn7 deleted file mode 100644 index 74a2846ea80c795808e1de4a0894e77f93bf7312..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.cuda10.0-cudnn7 +++ /dev/null @@ -1,181 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:10.0-cudnn7-devel-ubuntu16.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev - -RUN apt-get update && \ - apt-get install -y --allow-downgrades --allow-change-held-packages \ - patchelf git python-pip python-dev python-opencv openssh-server bison \ - wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ - curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ - automake locales clang-format swig \ - liblapack-dev liblapacke-dev libcurl4-openssl-dev \ - net-tools libtool module-init-tools vim && \ - apt-get clean -y - -RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so.10 && \ - ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/libcrypto.so.10 - -RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -O shellcheck-v0.7.1.linux.x86_64.tar.xz && \ - tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz && cp shellcheck-v0.7.1/shellcheck /usr/bin/shellcheck && \ - rm -rf shellcheck-v0.7.1.linux.x86_64.tar.xz shellcheck-v0.7.1 - -# Downgrade gcc&&g++ -RUN apt-get update - WORKDIR /usr/bin - RUN apt install -y gcc-4.8 g++-4.8 && cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ && ln -s gcc-4.8 gcc && ln -s g++-4.8 g++ - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.7 -RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ - tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.8 -RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ - tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. -ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -RUN apt-get install libprotobuf-dev -y - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. -RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ - dpkg -i patchelf_0.10-2_amd64.deb - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -CMD source ~/.bashrc - -# ccache 3.7.9 -RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ - tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ - ./configure -prefix=/usr/local/ccache-3.7.9 && \ - make -j8 && make install && \ - ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache - -RUN python3.8 -m pip install --upgrade pip requests && \ - python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.cuda10.0-cudnn7.devel b/tools/Dockerfile.cuda10.0-cudnn7.devel deleted file mode 100644 index 74a2846ea80c795808e1de4a0894e77f93bf7312..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.cuda10.0-cudnn7.devel +++ /dev/null @@ -1,181 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:10.0-cudnn7-devel-ubuntu16.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev - -RUN apt-get update && \ - apt-get install -y --allow-downgrades --allow-change-held-packages \ - patchelf git python-pip python-dev python-opencv openssh-server bison \ - wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ - curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ - automake locales clang-format swig \ - liblapack-dev liblapacke-dev libcurl4-openssl-dev \ - net-tools libtool module-init-tools vim && \ - apt-get clean -y - -RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so.10 && \ - ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/libcrypto.so.10 - -RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -O shellcheck-v0.7.1.linux.x86_64.tar.xz && \ - tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz && cp shellcheck-v0.7.1/shellcheck /usr/bin/shellcheck && \ - rm -rf shellcheck-v0.7.1.linux.x86_64.tar.xz shellcheck-v0.7.1 - -# Downgrade gcc&&g++ -RUN apt-get update - WORKDIR /usr/bin - RUN apt install -y gcc-4.8 g++-4.8 && cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ && ln -s gcc-4.8 gcc && ln -s g++-4.8 g++ - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.7 -RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ - tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.8 -RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ - tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. -ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -RUN apt-get install libprotobuf-dev -y - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. -RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ - dpkg -i patchelf_0.10-2_amd64.deb - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -CMD source ~/.bashrc - -# ccache 3.7.9 -RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ - tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ - ./configure -prefix=/usr/local/ccache-3.7.9 && \ - make -j8 && make install && \ - ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache - -RUN python3.8 -m pip install --upgrade pip requests && \ - python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.cuda10.1-cudnn7 b/tools/Dockerfile.cuda10.1-cudnn7 deleted file mode 100644 index a87c40f93ba67e9e2791e96b10e7449e70fa62b3..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.cuda10.1-cudnn7 +++ /dev/null @@ -1,187 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:10.1-cudnn7-devel-ubuntu16.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev - -RUN apt-get update && \ - apt-get install -y --allow-downgrades --allow-change-held-packages \ - patchelf git python-pip python-dev python-opencv openssh-server bison \ - wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ - curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ - automake locales clang-format swig \ - liblapack-dev liblapacke-dev libcurl4-openssl-dev \ - net-tools libtool module-init-tools vim && \ - apt-get clean -y - -RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so.10 && \ - ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/libcrypto.so.10 - -RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -O shellcheck-v0.7.1.linux.x86_64.tar.xz && \ - tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz && cp shellcheck-v0.7.1/shellcheck /usr/bin/shellcheck && \ - rm -rf shellcheck-v0.7.1.linux.x86_64.tar.xz shellcheck-v0.7.1 - -# Downgrade gcc&&g++ -WORKDIR /usr/bin - COPY tools/dockerfile/build_scripts /build_scripts - RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts - RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ - ENV PATH=/usr/local/gcc-8.2/bin:$PATH - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.7 -RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ - tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.8 -RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ - tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. -ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -RUN apt-get install libprotobuf-dev -y - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. -RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ - dpkg -i patchelf_0.10-2_amd64.deb - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -CMD source ~/.bashrc - -# ccache 3.7.9 -RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ - tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ - ./configure -prefix=/usr/local/ccache-3.7.9 && \ - make -j8 && make install && \ - ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache - -RUN python3.8 -m pip install --upgrade pip requests && \ - python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.cuda10.1-cudnn7.devel b/tools/Dockerfile.cuda10.1-cudnn7.devel index a87c40f93ba67e9e2791e96b10e7449e70fa62b3..991477abf58aa564428bffa794c7de300093942a 100644 --- a/tools/Dockerfile.cuda10.1-cudnn7.devel +++ b/tools/Dockerfile.cuda10.1-cudnn7.devel @@ -13,7 +13,7 @@ ENV WITH_AVX=${WITH_AVX:-ON} ENV HOME /root # Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ +COPY tools/dockerfiles/root/ /root/ # Prepare packages for Python RUN apt-get update && \ @@ -26,7 +26,7 @@ RUN apt-get update && \ patchelf git python-pip python-dev python-opencv openssh-server bison \ wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ + python-matplotlib unzip \ automake locales clang-format swig \ liblapack-dev liblapacke-dev libcurl4-openssl-dev \ net-tools libtool module-init-tools vim && \ @@ -41,7 +41,7 @@ RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellch # Downgrade gcc&&g++ WORKDIR /usr/bin - COPY tools/dockerfile/build_scripts /build_scripts + COPY tools/dockerfiles/build_scripts /build_scripts RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc @@ -58,67 +58,29 @@ ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH # Install Python3.6 RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ + ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz + +RUN wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.6.0* # Install Python3.7 RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.7.0* # Install Python3.8 RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.8.0* -RUN rm -r /root/python_build +ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH} +RUN ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 +RUN rm -r /root/python_build # Install Go and glide RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ @@ -141,7 +103,7 @@ ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} # See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. # Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts +COPY tools/dockerfiles/build_scripts /build_scripts RUN bash /build_scripts/install_trt.sh RUN rm -rf /build_scripts @@ -172,9 +134,7 @@ RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ RUN python3.8 -m pip install --upgrade pip requests && \ python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests + python3.6 -m pip install --upgrade pip requests RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ diff --git a/tools/Dockerfile.cuda10.2-cudnn8 b/tools/Dockerfile.cuda10.2-cudnn8 deleted file mode 100644 index ad4b4993b5fb0b36ce61a0aca609f2e68be9f2e9..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.cuda10.2-cudnn8 +++ /dev/null @@ -1,141 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:10.2-cudnn8-devel-ubuntu16.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential - -RUN apt-get update && \ - apt-get install -y --allow-downgrades --allow-change-held-packages \ - python-pip python-dev python-opencv \ - wget tar xz-utils bzip2 \ - curl sed grep \ - python-matplotlib \ - vim && \ - apt-get clean -y - -# Downgrade gcc&&g++ -WORKDIR /usr/bin - COPY tools/dockerfile/build_scripts /build_scripts - RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts - RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ - ENV PATH=/usr/local/gcc-8.2/bin:$PATH - -# install cmake -WORKDIR /home -RUN apt-get install -y make automake - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -ENV PATH=/usr/local/include/python3.6m/:${PATH} -ENV PATH=/usr/local/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.6 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. -ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -CMD source ~/.bashrc - -RUN python3.6 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.cuda10.2-cudnn8.devel b/tools/Dockerfile.cuda10.2-cudnn8.devel index ad4b4993b5fb0b36ce61a0aca609f2e68be9f2e9..e8cc0d6e21195133ea94bca414d94efcf837395a 100644 --- a/tools/Dockerfile.cuda10.2-cudnn8.devel +++ b/tools/Dockerfile.cuda10.2-cudnn8.devel @@ -13,24 +13,35 @@ ENV WITH_AVX=${WITH_AVX:-ON} ENV HOME /root # Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ +COPY tools/dockerfiles/root/ /root/ # Prepare packages for Python RUN apt-get update && \ - apt-get install -y make build-essential + apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ + libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ + xz-utils tk-dev libffi-dev liblzma-dev RUN apt-get update && \ apt-get install -y --allow-downgrades --allow-change-held-packages \ - python-pip python-dev python-opencv \ - wget tar xz-utils bzip2 \ - curl sed grep \ - python-matplotlib \ - vim && \ + patchelf git python-pip python-dev python-opencv openssh-server bison \ + wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ + curl sed grep graphviz libjpeg-dev zlib1g-dev \ + python-matplotlib unzip \ + automake locales clang-format swig \ + liblapack-dev liblapacke-dev libcurl4-openssl-dev \ + net-tools libtool module-init-tools vim && \ apt-get clean -y +RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so.10 && \ + ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/libcrypto.so.10 + +RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -O shellcheck-v0.7.1.linux.x86_64.tar.xz && \ + tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz && cp shellcheck-v0.7.1/shellcheck /usr/bin/shellcheck && \ + rm -rf shellcheck-v0.7.1.linux.x86_64.tar.xz shellcheck-v0.7.1 + # Downgrade gcc&&g++ WORKDIR /usr/bin - COPY tools/dockerfile/build_scripts /build_scripts + COPY tools/dockerfiles/build_scripts /build_scripts RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc @@ -41,53 +52,36 @@ WORKDIR /usr/bin # install cmake WORKDIR /home -RUN apt-get install -y make automake +RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz +ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH # Install Python3.6 RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ + ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz + +RUN wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.6.0* + +# Install Python3.7 +RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ + tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ + CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.7.0* + +# Install Python3.8 +RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ + tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ + CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.8.0* -ENV PATH=/usr/local/include/python3.6m/:${PATH} -ENV PATH=/usr/local/bin:${PATH} ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH RUN ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 RUN rm -r /root/python_build -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.6 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - # Install Go and glide RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ tar -xz -C /usr/local && \ @@ -109,7 +103,7 @@ ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} # See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. # Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts +COPY tools/dockerfiles/build_scripts /build_scripts RUN bash /build_scripts/install_trt.sh RUN rm -rf /build_scripts @@ -119,16 +113,28 @@ RUN git config --global credential.helper store # Fix locales to en_US.UTF-8 RUN localedef -i en_US -f UTF-8 en_US.UTF-8 +RUN apt-get install libprotobuf-dev -y + # Older versions of patchelf limited the size of the files being processed and were fixed in this pr. # https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa # So install a newer version here. +RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ + dpkg -i patchelf_0.10-2_amd64.deb # Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config CMD source ~/.bashrc -RUN python3.6 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests +# ccache 3.7.9 +RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ + tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ + ./configure -prefix=/usr/local/ccache-3.7.9 && \ + make -j8 && make install && \ + ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache + +RUN python3.8 -m pip install --upgrade pip requests && \ + python3.7 -m pip install --upgrade pip requests && \ + python3.6 -m pip install --upgrade pip requests RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ diff --git a/tools/Dockerfile.cuda11-cudnn8 b/tools/Dockerfile.cuda11-cudnn8 deleted file mode 100644 index 07f1ba0f5d387e889843d1f1dc4e108b81e12930..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.cuda11-cudnn8 +++ /dev/null @@ -1,189 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:11.0-cudnn8-devel-ubuntu18.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} -ENV DEBIAN_FRONTEND=noninteractive -ENV LD_LIBRARY_PATH=/usr/local/cuda-11.0/targets/x86_64-linux/lib:$LD_LIBRARY_PATH - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -RUN apt-get update && \ - apt-get install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && \ - apt-get update && \ - apt-get install -y curl wget vim git unzip unrar tar xz-utils libssl-dev bzip2 gzip \ - coreutils ntp language-pack-zh-hans python-qt4 libsm6 libxext6 libxrender-dev libgl1-mesa-glx \ - bison graphviz libjpeg-dev zlib1g-dev automake locales swig net-tools libtool module-init-tools libcurl4-openssl-dev libffi-dev - -RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /usr/lib/libssl.so.10 && \ - ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.10 - -# Downgrade gcc&&g++ -WORKDIR /usr/bin -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts -RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ -RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc -RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ -RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc -RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ -ENV PATH=/usr/local/gcc-8.2/bin:$PATH - - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.7 -RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ - tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.8 -RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ - tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# remove them when apt-get support 2.27 and higher version -RUN wget -q https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.gz && \ - tar -xzf binutils-2.33.1.tar.gz && \ - cd binutils-2.33.1 && \ - ./configure && make -j && make install && cd .. && rm -rf binutils-2.33.1 binutils-2.33.1.tar.gz - - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -ENV PATH=/usr/local/go/bin:/root/go/bin:$PATH - - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -RUN apt-get install libprotobuf-dev -y - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. -RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ - dpkg -i patchelf_0.10-2_amd64.deb - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -#RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -#CMD source ~/.bashrc - -# ccache 3.7.9 -RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ - tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ - ./configure -prefix=/usr/local/ccache-3.7.9 && \ - make -j8 && make install && \ - ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache - -RUN ln -s /usr/share/pyshared/lsb_release.py /usr/bin/lsb_release.py -RUN python3.8 -m pip install --upgrade pip requests && \ - python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.cuda9.0-cudnn7 b/tools/Dockerfile.cuda9.0-cudnn7 deleted file mode 100644 index eb715683be9f6da1d8a00eaa085a81688c11a3b3..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.cuda9.0-cudnn7 +++ /dev/null @@ -1,181 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:9.0-cudnn7-devel-ubuntu16.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev - -RUN apt-get update && \ - apt-get install -y --allow-downgrades --allow-change-held-packages \ - patchelf git python-pip python-dev python-opencv openssh-server bison \ - wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ - curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ - automake locales clang-format swig \ - liblapack-dev liblapacke-dev libcurl4-openssl-dev \ - net-tools libtool module-init-tools vim && \ - apt-get clean -y - -RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so.10 && \ - ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/libcrypto.so.10 - -RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -O shellcheck-v0.7.1.linux.x86_64.tar.xz && \ - tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz && cp shellcheck-v0.7.1/shellcheck /usr/bin/shellcheck && \ - rm -rf shellcheck-v0.7.1.linux.x86_64.tar.xz shellcheck-v0.7.1 - -# Downgrade gcc&&g++ -RUN apt-get update - WORKDIR /usr/bin - RUN apt install -y gcc-4.8 g++-4.8 && cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ && ln -s gcc-4.8 gcc && ln -s g++-4.8 g++ - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.7 -RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ - tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.8 -RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ - tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. -ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -RUN apt-get install libprotobuf-dev -y - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. -RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ - dpkg -i patchelf_0.10-2_amd64.deb - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -CMD source ~/.bashrc - -# ccache 3.7.9 -RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ - tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ - ./configure -prefix=/usr/local/ccache-3.7.9 && \ - make -j8 && make install && \ - ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache - -RUN python3.8 -m pip install --upgrade pip requests && \ - python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.cuda9.0-cudnn7.devel b/tools/Dockerfile.cuda9.0-cudnn7.devel deleted file mode 100644 index eb715683be9f6da1d8a00eaa085a81688c11a3b3..0000000000000000000000000000000000000000 --- a/tools/Dockerfile.cuda9.0-cudnn7.devel +++ /dev/null @@ -1,181 +0,0 @@ -# A image for building paddle binaries -# Use cuda devel base image for both cpu and gpu environment -# When you modify it, please be aware of cudnn-runtime version -FROM hub.baidubce.com/ctr/cuda:9.0-cudnn7-devel-ubuntu16.04 -MAINTAINER PaddlePaddle Authors - -# ENV variables -ARG WITH_GPU -ARG WITH_AVX - -ENV WITH_GPU=${WITH_GPU:-ON} -ENV WITH_AVX=${WITH_AVX:-ON} - -ENV HOME /root -# Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ - -# Prepare packages for Python -RUN apt-get update && \ - apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ - libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ - xz-utils tk-dev libffi-dev liblzma-dev - -RUN apt-get update && \ - apt-get install -y --allow-downgrades --allow-change-held-packages \ - patchelf git python-pip python-dev python-opencv openssh-server bison \ - wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ - curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ - automake locales clang-format swig \ - liblapack-dev liblapacke-dev libcurl4-openssl-dev \ - net-tools libtool module-init-tools vim && \ - apt-get clean -y - -RUN ln -s /usr/lib/x86_64-linux-gnu/libssl.so /usr/lib/libssl.so.10 && \ - ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so /usr/lib/libcrypto.so.10 - -RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -O shellcheck-v0.7.1.linux.x86_64.tar.xz && \ - tar -xf shellcheck-v0.7.1.linux.x86_64.tar.xz && cp shellcheck-v0.7.1/shellcheck /usr/bin/shellcheck && \ - rm -rf shellcheck-v0.7.1.linux.x86_64.tar.xz shellcheck-v0.7.1 - -# Downgrade gcc&&g++ -RUN apt-get update - WORKDIR /usr/bin - RUN apt install -y gcc-4.8 g++-4.8 && cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ && ln -s gcc-4.8 gcc && ln -s g++-4.8 g++ - -# install cmake -WORKDIR /home -RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz -ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH - -# Install Python3.6 -RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ - tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ - tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.7 -RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ - tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.8 -RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ - tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 - -RUN rm -r /root/python_build - -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 - -# Install Go and glide -RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ - tar -xz -C /usr/local && \ - mkdir /root/go && \ - mkdir /root/go/bin && \ - mkdir /root/go/src && \ - echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ - echo "GOPATH=/root/go" >> /root/.bashrc && \ - echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc -ENV GOROOT=/usr/local/go GOPATH=/root/go -# should not be in the same line with GOROOT definition, otherwise docker build could not find GOROOT. -ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} - -# Install TensorRT -# following TensorRT.tar.gz is not the default official one, we do two miny changes: -# 1. Remove the unnecessary files to make the library small. TensorRT.tar.gz only contains include and lib now, -# and its size is only one-third of the official one. -# 2. Manually add ~IPluginFactory() in IPluginFactory class of NvInfer.h, otherwise, it couldn't work in paddle. -# See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. - -# Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts -RUN bash /build_scripts/install_trt.sh -RUN rm -rf /build_scripts - -# git credential to skip password typing -RUN git config --global credential.helper store - -# Fix locales to en_US.UTF-8 -RUN localedef -i en_US -f UTF-8 en_US.UTF-8 - -RUN apt-get install libprotobuf-dev -y - -# Older versions of patchelf limited the size of the files being processed and were fixed in this pr. -# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa -# So install a newer version here. -RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \ - dpkg -i patchelf_0.10-2_amd64.deb - -# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service -RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config -CMD source ~/.bashrc - -# ccache 3.7.9 -RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ - tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \ - ./configure -prefix=/usr/local/ccache-3.7.9 && \ - make -j8 && make install && \ - ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache - -RUN python3.8 -m pip install --upgrade pip requests && \ - python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests - -RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ - tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ - mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ - ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ - ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ - ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ - ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so - -EXPOSE 22 diff --git a/tools/Dockerfile.devel b/tools/Dockerfile.devel index ab83229af56c65cb9505b524eb08fe5ce2931a5b..b83d611ab03c1aba80e7504399c646d140e1bc04 100644 --- a/tools/Dockerfile.devel +++ b/tools/Dockerfile.devel @@ -13,7 +13,7 @@ ENV WITH_AVX=${WITH_AVX:-ON} ENV HOME /root # Add bash enhancements -COPY tools/dockerfile/scripts/root/ /root/ +COPY tools/dockerfiles/root/ /root/ # Prepare packages for Python RUN apt-get update && \ @@ -26,7 +26,7 @@ RUN apt-get update && \ patchelf git python-pip python-dev python-opencv openssh-server bison \ wget unzip unrar tar xz-utils bzip2 gzip coreutils ntp \ curl sed grep graphviz libjpeg-dev zlib1g-dev \ - python-matplotlib \ + python-matplotlib unzip \ automake locales clang-format swig \ liblapack-dev liblapacke-dev libcurl4-openssl-dev \ net-tools libtool module-init-tools vim && \ @@ -41,7 +41,7 @@ RUN wget https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellch # Downgrade gcc&&g++ WORKDIR /usr/bin - COPY tools/dockerfile/build_scripts /build_scripts + COPY tools/dockerfiles/build_scripts /build_scripts RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc @@ -58,67 +58,29 @@ ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH # Install Python3.6 RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \ tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \ - ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \ - wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ + ./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz + +RUN wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \ tar -xzf Python-3.6.0.tgz && cd Python-3.6.0 && \ CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.6.0* # Install Python3.7 RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.7.0* # Install Python3.8 RUN wget -q https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz && \ tar -xzf Python-3.8.0.tgz && cd Python-3.8.0 && \ CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig - -# Install Python3.5 -RUN wget -q https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz && \ - tar -xzf Python-3.5.1.tgz && cd Python-3.5.1 && \ - CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.5.1 --enable-shared > /dev/null && \ - make -j8 > /dev/null && make altinstall > /dev/null && ldconfig -ENV PATH=/usr/local/include/python3.6m/:/usr/local/python3.5.1/include:${PATH} -ENV PATH=/usr/local/bin:/usr/local/python3.5.1/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/python3.5.1/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python3.5.1/include/python3.5:/usr/local/include/python3.6m/:$CPLUS_INCLUDE_PATH -RUN ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/local/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/python3.5 /usr/bin/python3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/local/bin/pip3.5 && ln -sf /usr/local/python3.5.1/bin/pip3.5 /usr/bin/pip3.5 && ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && cd .. && rm -rf Python-3.8.0* -RUN rm -r /root/python_build +ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH} +RUN ln -sf /usr/local/bin/python3.6 /usr/local/bin/python3 && ln -sf /usr/local/bin/python3.6 /usr/bin/python3 && ln -sf /usr/local/bin/pip3.6 /usr/local/bin/pip3 && ln -sf /usr/local/bin/pip3.6 /usr/bin/pip3 -# Install Python2.7.15 to replace original python -WORKDIR /home -ENV version=2.7.15 -RUN wget https://www.python.org/ftp/python/$version/Python-$version.tgz && tar -xvf Python-$version.tgz -WORKDIR /home/Python-$version -RUN ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/python2.7.15 && make && make install - -RUN echo "export PATH=/usr/local/python2.7.15/include:${PATH}" >> ~/.bashrc && echo "export PATH=/usr/local/python2.7.15/bin:${PATH}" >> ~/.bashrc && echo "export LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH}" >> ~/.bashrc && echo "export CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH" >> ~/.bashrc -ENV PATH=/usr/local/python2.7.15/include:${PATH} -ENV PATH=/usr/local/python2.7.15/bin:${PATH} -ENV LD_LIBRARY_PATH=/usr/local/python2.7.15/lib:${LD_LIBRARY_PATH} -ENV CPLUS_INCLUDE_PATH=/usr/local/python2.7.15/include/python2.7:$CPLUS_INCLUDE_PATH -RUN mv /usr/bin/python /usr/bin/python.bak && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/local/bin/python && ln -s /usr/local/python2.7.15/bin/python2.7 /usr/bin/python - -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip -WORKDIR /home/setuptools-40.6.2 -RUN python setup.py build && python setup.py install -WORKDIR /home -RUN wget https://files.pythonhosted.org/packages/69/81/52b68d0a4de760a2f1979b0931ba7889202f302072cc7a0d614211bc7579/pip-18.0.tar.gz && tar -zxvf pip-18.0.tar.gz -WORKDIR pip-18.0 -RUN python setup.py install && \ - python3.8 setup.py install && \ - python3.7 setup.py install && \ - python3.6 setup.py install && \ - python3.5 setup.py install - -WORKDIR /home -RUN rm Python-$version.tgz setuptools-40.6.2.zip pip-18.0.tar.gz && \ - rm -r Python-$version setuptools-40.6.2 pip-18.0 +RUN rm -r /root/python_build # Install Go and glide RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ @@ -141,7 +103,7 @@ ENV PATH=usr/local/go/bin:/root/go/bin:${PATH} # See https://github.com/PaddlePaddle/Paddle/issues/10129 for details. # Downgrade TensorRT -COPY tools/dockerfile/build_scripts /build_scripts +COPY tools/dockerfiles/build_scripts /build_scripts RUN bash /build_scripts/install_trt.sh RUN rm -rf /build_scripts @@ -172,9 +134,7 @@ RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ RUN python3.8 -m pip install --upgrade pip requests && \ python3.7 -m pip install --upgrade pip requests && \ - python3.6 -m pip install --upgrade pip requests && \ - python3.5 -m pip install --upgrade pip requests && \ - python2.7 -m pip install --upgrade pip requests + python3.6 -m pip install --upgrade pip requests RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ diff --git a/tools/Dockerfile.runtime_template b/tools/Dockerfile.runtime_template new file mode 100644 index 0000000000000000000000000000000000000000..9b78b101eadbec6ce48212155d2a43efa31bb488 --- /dev/null +++ b/tools/Dockerfile.runtime_template @@ -0,0 +1,56 @@ +# Dockerfile template +FROM <> + +RUN apt-get update && \ + apt-get install -y make build-essential + +RUN apt-get update && \ + apt-get install -y wget tar xz-utils bzip2 libcurl4-openssl-dev \ + curl sed grep zlib1g-dev libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev && \ + apt-get clean -y + +WORKDIR /usr/bin + COPY tools/dockerfiles/build_scripts /build_scripts + RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts + RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ + RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc + RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ + RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc + RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ + ENV PATH=/usr/local/gcc-8.2/bin:$PATH + +# install python +WORKDIR /home + COPY tools/dockerfiles/build_scripts /build_scripts + RUN bash /build_scripts/install_python.sh <> && rm -rf /build_scripts + # Other + +# install whl and bin +WORKDIR /home + COPY tools/dockerfiles/build_scripts /build_scripts + RUN bash /build_scripts/install_whl.sh 0.5.0 2.0.0 <> <> && rm -rf /build_scripts + +# install tensorrt +WORKDIR /home + COPY tools/dockerfiles/build_scripts /build_scripts + RUN bash /build_scripts/install_trt.sh && rm -rf /build_scripts + +# install go +RUN wget -qO- https://dl.google.com/go/go1.14.linux-amd64.tar.gz | \ + tar -xz -C /usr/local && \ + mkdir /root/go && \ + mkdir /root/go/bin && \ + mkdir /root/go/src && \ + echo "GOROOT=/usr/local/go" >> /root/.bashrc && \ + echo "GOPATH=/root/go" >> /root/.bashrc && \ + echo "PATH=/usr/local/go/bin:/root/go/bin:$PATH" >> /root/.bashrc + +RUN wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \ + tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \ + mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \ + ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \ + ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \ + ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \ + ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so + +EXPOSE 22 diff --git a/tools/dockerfile/build_scripts/build.sh b/tools/dockerfiles/build_scripts/build.sh similarity index 100% rename from tools/dockerfile/build_scripts/build.sh rename to tools/dockerfiles/build_scripts/build.sh diff --git a/tools/dockerfile/build_scripts/build_utils.sh b/tools/dockerfiles/build_scripts/build_utils.sh similarity index 100% rename from tools/dockerfile/build_scripts/build_utils.sh rename to tools/dockerfiles/build_scripts/build_utils.sh diff --git a/tools/dockerfile/build_scripts/install_gcc.sh b/tools/dockerfiles/build_scripts/install_gcc.sh similarity index 97% rename from tools/dockerfile/build_scripts/install_gcc.sh rename to tools/dockerfiles/build_scripts/install_gcc.sh index e75021b2a9b6531701ef1365e9e6195b61770632..bf0dd5f2eded9e9b3b645c1e9f1b3032209f4899 100644 --- a/tools/dockerfile/build_scripts/install_gcc.sh +++ b/tools/dockerfiles/build_scripts/install_gcc.sh @@ -39,6 +39,7 @@ if [ "$1" == "gcc82" ]; then ../gcc-8.2.0/configure --prefix=/usr/local/gcc-8.2 --enable-threads=posix --disable-checking --disable-multilib && \ make -j8 && make install cd .. && rm -rf temp_gcc82 + rm -rf gcc-8.2.0 gcc-8.2.0.tar.xz cp ${lib_so_6} ${lib_so_6}.bak && rm -f ${lib_so_6} && ln -s /usr/local/gcc-8.2/lib64/libgfortran.so.5 ${lib_so_5} && \ ln -s /usr/local/gcc-8.2/lib64/libstdc++.so.6 ${lib_so_6} && \ diff --git a/tools/dockerfile/build_scripts/install_nccl2.sh b/tools/dockerfiles/build_scripts/install_nccl2.sh similarity index 100% rename from tools/dockerfile/build_scripts/install_nccl2.sh rename to tools/dockerfiles/build_scripts/install_nccl2.sh diff --git a/tools/dockerfiles/build_scripts/install_python.sh b/tools/dockerfiles/build_scripts/install_python.sh new file mode 100644 index 0000000000000000000000000000000000000000..4809a31c1ede56fa98bc4309296f5673d3db1650 --- /dev/null +++ b/tools/dockerfiles/build_scripts/install_python.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Copyright (c) 2020 PaddlePaddle Authors. 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 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +VERSION=$1 + +if [[ "$VERSION" == "2.7" ]];then + wget -q https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz && tar -xvf Python-2.7.15.tgz && cd Python-2.7.15 + ./configure --enable-unicode=ucs4 --enable-shared CFLAGS=-fPIC --prefix=/usr/local/ && make && make install -j8 > /dev/null && make altinstall > /dev/null && ldconfig + cd .. && rm -rf Python-2.7.15* + wget https://bootstrap.pypa.io/pip/2.7/get-pip.py + python2.7 get-pip.py + rm -rf get-pip.py +elif [[ "$VERSION" == "3.6" ]];then + wget -q https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz && \ + tar -xzf Python-3.6.8.tgz && cd Python-3.6.8 && \ + CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + cd .. && rm -rf Python-3.6.8* + python3.6 -m pip install -U pip +elif [[ "$VERSION" == "3.7" ]];then + wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \ + tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \ + CFLAGS="-Wformat" ./configure --prefix=/usr/local/ --enable-shared > /dev/null && \ + make -j8 > /dev/null && make altinstall > /dev/null && ldconfig + cd .. && rm -rf Python-3.7.0* + python3.7 -m pip install -U pip +fi diff --git a/tools/dockerfile/build_scripts/install_trt.sh b/tools/dockerfiles/build_scripts/install_trt.sh similarity index 100% rename from tools/dockerfile/build_scripts/install_trt.sh rename to tools/dockerfiles/build_scripts/install_trt.sh diff --git a/tools/dockerfiles/build_scripts/install_whl.sh b/tools/dockerfiles/build_scripts/install_whl.sh new file mode 100644 index 0000000000000000000000000000000000000000..8d27e953b4e57d0cee80377744e764eb0a122735 --- /dev/null +++ b/tools/dockerfiles/build_scripts/install_whl.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Copyright (c) 2020 PaddlePaddle Authors. 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 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SERVING_VERSION=$1 +PADDLE_VERSION=$2 +RUN_ENV=$3 # cpu/10.1 10.2 +PYTHON_VERSION=$4 + +client_release="paddle-serving-client==$SERVING_VERSION" +app_release="paddle-serving-app==0.3.1" +if [[ "$RUN_ENV" == "cpu" ]];then + server_release="paddle-serving-server==$SERVING_VERSION" + python$PYTHON_VERSION -m pip install $client_release $app_release $server_release + python$PYTHON_VERSION -m pip install paddlepaddle==${PADDLE_VERSION} + cd /usr/local/ + wget https://paddle-serving.bj.bcebos.com/bin/serving-cpu-noavx-openblas-${SERVING_VERSION}.tar.gz + tar xf serving-cpu-noavx-openblas-${SERVING_VERSION}.tar.gz + echo "export SERVING_BIN=$PWD/serving-cpu-noavx-openblas-${SERVING_VERSION}/serving">>/root/.bashrc + rm -rf serving-cpu-noavx-openblas-${SERVING_VERSION}.tar.gz + cd - +elif [[ "$RUN_ENV" == "cuda10.1" ]];then + server_release="paddle-serving-server-gpu==$SERVING_VERSION.post101" + python$PYTHON_VERSION -m pip install $client_release $app_release $server_release + python$PYTHON_VERSION -m pip install paddlepaddle-gpu==${PADDLE_VERSION} + cd /usr/local/ + wget https://paddle-serving.bj.bcebos.com/bin/serving-gpu-101-${SERVING_VERSION}.tar.gz + tar xf serving-gpu-101-${SERVING_VERSION}.tar.gz + echo "export SERVING_BIN=$PWD/serving-gpu-101-${SERVING_VERSION}/serving">>/root/.bashrc + rm -rf serving-gpu-101-${SERVING_VERSION}.tar.gz + cd - +elif [[ "$RUN_ENV" == "cuda10.2" ]];then + server_release="paddle-serving-server-gpu==$SERVING_VERSION.post102" + python$PYTHON_VERSION -m pip install $client_release $app_release $server_release + python$PYTHON_VERSION -m pip install paddlepaddle-gpu==${PADDLE_VERSION} + cd /usr/local/ + wget https://paddle-serving.bj.bcebos.com/bin/serving-gpu-102-${SERVING_VERSION}.tar.gz + tar xf serving-gpu-102-${SERVING_VERSION}.tar.gz + echo "export SERVING_BIN=$PWD/serving-gpu-102-${SERVING_VERSION}/serving">>/root/.bashrc + rm -rf serving-gpu-102-${SERVING_VERSION}.tar.gz + cd - +fi + + diff --git a/tools/dockerfile/build_scripts/manylinux1-check.py b/tools/dockerfiles/build_scripts/manylinux1-check.py similarity index 100% rename from tools/dockerfile/build_scripts/manylinux1-check.py rename to tools/dockerfiles/build_scripts/manylinux1-check.py diff --git a/tools/dockerfile/build_scripts/python-tag-abi-tag.py b/tools/dockerfiles/build_scripts/python-tag-abi-tag.py similarity index 100% rename from tools/dockerfile/build_scripts/python-tag-abi-tag.py rename to tools/dockerfiles/build_scripts/python-tag-abi-tag.py diff --git a/tools/dockerfile/build_scripts/ssl-check.py b/tools/dockerfiles/build_scripts/ssl-check.py similarity index 100% rename from tools/dockerfile/build_scripts/ssl-check.py rename to tools/dockerfiles/build_scripts/ssl-check.py diff --git a/tools/dockerfile/root/.bashrc b/tools/dockerfiles/root/.bashrc similarity index 100% rename from tools/dockerfile/root/.bashrc rename to tools/dockerfiles/root/.bashrc diff --git a/tools/dockerfile/root/.gitconfig b/tools/dockerfiles/root/.gitconfig similarity index 100% rename from tools/dockerfile/root/.gitconfig rename to tools/dockerfiles/root/.gitconfig diff --git a/tools/dockerfile/root/.scripts/git-completion.sh b/tools/dockerfiles/root/.scripts/git-completion.sh similarity index 100% rename from tools/dockerfile/root/.scripts/git-completion.sh rename to tools/dockerfiles/root/.scripts/git-completion.sh diff --git a/tools/dockerfile/root/.scripts/git-prompt.sh b/tools/dockerfiles/root/.scripts/git-prompt.sh similarity index 100% rename from tools/dockerfile/root/.scripts/git-prompt.sh rename to tools/dockerfiles/root/.scripts/git-prompt.sh diff --git a/tools/generate_k8s_yamls.sh b/tools/generate_k8s_yamls.sh new file mode 100644 index 0000000000000000000000000000000000000000..6a3f8783f3564125f16eb917b4198c580691978d --- /dev/null +++ b/tools/generate_k8s_yamls.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +#abort on error +set -e + +function usage +{ + echo "usage: sh tools/generate_k8s_yaml.sh --SOME_ARG ARG_VALUE" + echo " "; + echo " --app_name : app name"; + echo " --image_name : image name"; + echo " --workdir : workdir in image"; + echo " --command : command to launch serving" + echo " --port : serving port" + echo " -h | --help : helper"; +} + +function parse_args +{ + # positional args + args=() + + # named args + while [ "$1" != "" ]; do + case "$1" in + --app_name ) app_name="$2"; shift;; + --image_name ) image_name="$2"; shift;; + --workdir ) workdir="$2"; shift;; + --command ) start_command="$2"; shift;; + --port ) port="$2"; shift;; + -h | --help ) usage; exit;; # quit and show usage + * ) args+=("$1") # if no match, add it to the positional args + esac + shift # move to next kv pair + done + # restore positional args + set -- "${args[@]}" + + # set positionals to vars + positional_1="${args[0]}" + positional_2="${args[1]}" + + # validate required args + if [[ -z "${app_name}" || -z "${image_name}" || -z "${workdir}" || -z "${start_command}" || -z "${port}" ]]; then + echo "Invalid arguments. check your params again." + usage + exit; + fi + +} + + +function run +{ + parse_args "$@" + + echo "named arg: app_name: $app_name" + echo "named arg: image_name: $image_name" + echo "named arg: workdir: $workdir" + echo "named arg: command: $start_command" + echo "named arg: port: $port" + + sed -e "s/<< APP_NAME >>/$app_name/g" -e "s/<< IMAGE_NAME >>/$(echo $image_name | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g')/g" -e "s/<< WORKDIR >>/$(echo $workdir | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g')/g" -e "s/<< COMMAND >>/\"$start_command\"/g" -e "s/<< PORT >>/$port/g" tools/k8s_serving.yaml_template > k8s_serving.yaml + sed -e "s/<< APP_NAME >>/$app_name/g" -e "s/<< IMAGE_NAME >>/$(echo $image_name | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g')/g" -e "s/<< WORKDIR >>/$(echo $workdir | sed -e 's/\\/\\\\/g; s/\//\\\//g; s/&/\\\&/g')/g" -e "s/<< COMMAND >>/\"$start_command\"/g" -e "s/<< PORT >>/$port/g" tools/k8s_ingress.yaml_template > k8s_ingress.yaml + echo "check k8s_serving.yaml and k8s_ingress.yaml please." +} + +run "$@"; diff --git a/tools/generate_runtime_docker.sh b/tools/generate_runtime_docker.sh new file mode 100644 index 0000000000000000000000000000000000000000..0ee050f22da8899a7565af8b92d0c5bccb62eefb --- /dev/null +++ b/tools/generate_runtime_docker.sh @@ -0,0 +1,80 @@ +#!/bin/sh + +#abort on error +set -e + +function usage +{ + echo "usage: sh tools/generate_runtime_docker.sh --SOME_ARG ARG_VALUE" + echo " "; + echo " --env : running env, cpu/cuda10.1/cuda10.2/cuda11"; + echo " --python : python version, 2.7/3.6/3.7 "; + echo " --serving : serving version(0.5.0)"; + echo " --paddle : paddle version(2.0.1)" + echo " --image_name : image name(default serving_runtime:env-python)" + echo " -h | --help : helper"; +} + +function parse_args +{ + # positional args + args=() + + # named args + while [ "$1" != "" ]; do + case "$1" in + --env ) env="$2"; shift;; + --python ) python="$2"; shift;; + --serving ) serving="$2"; shift;; + --paddle ) paddle="$2"; shift;; + --image_name ) image_name="$2"; shift;; + -h | --help ) usage; exit;; # quit and show usage + * ) args+=("$1") # if no match, add it to the positional args + esac + shift # move to next kv pair + done + # restore positional args + set -- "${args[@]}" + + # set positionals to vars + positional_1="${args[0]}" + positional_2="${args[1]}" + + # validate required args + if [[ -z "${paddle}" || -z "${env}" || -z "${python}" || -z "${serving}" ]]; then + echo "Invalid arguments. paddle or env or python or serving is missing." + usage + exit; + fi + + if [[ -z "${image_name}" ]]; then + image_name="serving_runtime:$env-$python" + echo "image_name is not assigned, so it will be set ($image_name)." + fi + +} + + +function run +{ + parse_args "$@" + + echo "named arg: env: $env" + if [ $env == "cpu" ]; then + base_image="ubuntu:16.04" + elif [ $env == "cuda10.1" ]; then + base_image="nvidia\/cuda:10.1-cudnn7-runtime-ubuntu16.04" + elif [ $env == "cuda10.2" ]; then + base_image="nvidia\/cuda:10.2-cudnn8-runtime-ubuntu16.04" + fi + echo "base image: $base_image" + echo "named arg: python: $python" + echo "named arg: serving: $serving" + echo "named arg: paddle: $paddle" + echo "named arg: image_name: $image_name" + + sed -e "s/<>/$base_image/g" -e "s/<>/$python/g" -e "s/<>/$env/g" tools/Dockerfile.runtime_template > Dockerfile.tmp + docker build --build-arg ftp_proxy=http://172.19.57.45:3128 --build-arg https_proxy=http://172.19.57.45:3128 --build-arg http_proxy=http://172.19.57.45:3128 --build-arg HTTP_PROXY=http://172.19.57.45:3128 --build-arg HTTPS_PROXY=http://172.19.57.45:3128 -t $image_name -f Dockerfile.tmp . +} + +run "$@"; diff --git a/tools/k8s_ingress.yaml_template b/tools/k8s_ingress.yaml_template new file mode 100644 index 0000000000000000000000000000000000000000..13e734fb5ecd5fb11eb5be9471136962a336683c --- /dev/null +++ b/tools/k8s_ingress.yaml_template @@ -0,0 +1,15 @@ +#kong_api.yaml +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: << APP_NAME >> + annotations: + kubernetes.io/ingress.class: kong +spec: + rules: + - http: + paths: + - path: /<< APP_NAME >> + backend: + serviceName: << APP_NAME >> + servicePort: << PORT >> diff --git a/tools/k8s_serving.yaml_template b/tools/k8s_serving.yaml_template new file mode 100644 index 0000000000000000000000000000000000000000..17d103c8798ef778458663fd6c5aa4f38a1649fd --- /dev/null +++ b/tools/k8s_serving.yaml_template @@ -0,0 +1,60 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: << APP_NAME >> + name: << APP_NAME >> +spec: + ports: + - port: << PORT >> + name: http + protocol: TCP + targetPort: << PORT >> + selector: + app: << APP_NAME >> +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: << APP_NAME >> + name: << APP_NAME >> +spec: + replicas: 1 + selector: + matchLabels: + app: << APP_NAME >> + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + app: << APP_NAME >> + spec: + containers: + - image: << IMAGE_NAME >> + name: << APP_NAME >> + ports: + - containerPort: << PORT >> + workingDir: << WORKDIR >> + name: << APP_NAME >> + command: ['/bin/bash', '-c'] + args: [<< COMMAND >>] + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + resources: {}