添加推理服务的构建镜像

This commit is contained in:
pengluan 2022-06-28 10:58:03 +08:00
parent 52be0cee40
commit db2b3961c7
8 changed files with 178 additions and 0 deletions

View File

@ -0,0 +1,18 @@
set -ex
hubhost=ccr.ccs.tencentyun.com/cube-studio
git clone https://github.com/microsoft/onnxruntime.git
cd onnxruntime/dockerfiles
docker build -t $hubhost/onnxruntime:cpu -f Dockerfile.source ..
docker push $hubhost/onnxruntime:cpu
docker build -t $hubhost/onnxruntime:cuda -f Dockerfile.cuda ..
docker push $hubhost/onnxruntime:cuda
docker build -t $hubhost/onnxruntime:tensorrt -f Dockerfile.tensorrt ..
docker push $hubhost/onnxruntime:tensorrt
docker build -t $hubhost/onnxruntime:tensorrt -f Dockerfile.tensorrt ..
docker push $hubhost/onnxruntime:tensorrt
# 地址https://github.com/microsoft/onnxruntime/tree/master/dockerfiles

View File

@ -0,0 +1,29 @@
import requests
from __future__ import print_function
import base64
import io
import json
import numpy as np
from PIL import Image # pip install Pillow
import requests
headers={
"Content-Type": "application/json"
}
# onnxruntime
SERVER_URL = 'http://onnxruntime-resnet50-202112281143.kfserving/v1/models/resnet50'
IMAGE_PATH = 'smallcat.jpg'
files = {'data': open(IMAGE_PATH, 'rb')}
response = requests.post(SERVER_URL, data=files,headers=headers)
print(response.json())
# print(response.content)
print(response.status_code)
response.raise_for_status()

View File

@ -0,0 +1,34 @@
ARG FROM_IMAGES
FROM $FROM_IMAGES
ENV LANGUAGE en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
ENV LC_MESSAGES en_US.UTF-8
ENV TZ Asia/Shanghai
# 切换内部源
RUN apt update -y && apt-get install -y wget
# 安装运维工具
RUN apt install -y --force-yes --no-install-recommends vim apt-transport-https gnupg2 ca-certificates-java rsync jq wget git dnsutils iputils-ping net-tools curl locales zip
# 安装python
RUN apt install -y python3.6-dev python3-pip libsasl2-dev libpq-dev \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& ln -s /usr/bin/pip3 /usr/bin/pip
# 安装中文
RUN apt install -y --force-yes --no-install-recommends locales ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy && locale-gen zh_CN && locale-gen zh_CN.utf8
ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
ENV LANGUAGE zh_CN.UTF-8
# 便捷操作
RUN echo "alias ll='ls -alF'" >> /root/.bashrc && \
echo "alias la='ls -A'" >> /root/.bashrc && \
echo "alias vi='vim'" >> /root/.bashrc && \
/bin/bash -c "source /root/.bashrc"

View File

@ -0,0 +1,14 @@
set -ex
hubhost=ccr.ccs.tencentyun.com/cube-studio
arr=("serving:1.11.0" "serving:1.11.0-gpu" "serving:1.12.0" "serving:1.12.0-gpu" "serving:1.13.0" "serving:1.13.0-gpu" "serving:1.14.0" "serving:1.14.0-gpu" "serving:2.0.0" "serving:2.0.0-gpu" "serving:2.1.4" "serving:2.1.4-gpu" "serving:2.2.3" "serving:2.2.3-gpu" "serving:2.3.4" "serving:2.3.4-gpu" "serving:2.4.3" "serving:2.4.3-gpu" "serving:2.5.2" "serving:2.5.2-gpu" "serving:2.6.0" "serving:2.6.0-gpu")
for value in ${arr[@]}
do
echo $value
docker build -t $hubhost/$value --build-arg FROM_IMAGES=tensorflow/$value .
docker push $hubhost/$value
done

View File

@ -0,0 +1,30 @@
ARG FROM_IMAGES
FROM $FROM_IMAGES
USER root
WORKDIR /root
## 切换内部源
RUN apt update && apt-get install wget
# 安装运维工具
RUN apt install -y --force-yes --no-install-recommends vim apt-transport-https gnupg2 ca-certificates-java rsync jq wget git dnsutils iputils-ping net-tools curl locales zip unzip
# 安装中文
RUN apt install -y --force-yes --no-install-recommends locales ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy && locale-gen zh_CN && locale-gen zh_CN.utf8
ENV LANG zh_CN.UTF-8
ENV LC_ALL zh_CN.UTF-8
ENV LANGUAGE zh_CN.UTF-8
# 便捷操作
RUN echo "alias ll='ls -alF'" >> /root/.bashrc && \
echo "alias la='ls -A'" >> /root/.bashrc && \
echo "alias vi='vim'" >> /root/.bashrc && \
/bin/bash -c "source /root/.bashrc"
# 安装python基础包
RUN pip install pysnooper
ENV TEMP=/root
ENV TZ=Asia/Shanghai

View File

@ -0,0 +1,15 @@
set -ex
hubhost=ccr.ccs.tencentyun.com/cube-studio
arr=("torchserve:0.4.2-cpu" "torchserve:0.4.2-gpu" "torchserve:0.5.0-cpu" "torchserve:0.5.0-gpu" "torchserve:0.6.0-cpu" "torchserve:0.6.0-gpu")
for value in ${arr[@]}
do
echo $value
docker build -t $hubhost/$value --build-arg FROM_IMAGES=pytorch/$value .
docker push $hubhost/$value
done

View File

@ -0,0 +1,24 @@
ARG FROM_IMAGES
FROM $FROM_IMAGES
## 切换内部源
RUN apt update && apt-get install wget
ENV TZ Asia/Shanghai
# 安装运维工具
RUN apt update && apt install -y --no-install-recommends vim apt-transport-https gnupg2 ca-certificates-java rsync jq wget git dnsutils iputils-ping net-tools curl zip
## 安装中文
#RUN apt install -y --no-install-recommends locales ttf-wqy-microhei ttf-wqy-zenhei xfonts-wqy && locale-gen zh_CN && locale-gen zh_CN.utf8
#ENV LANG zh_CN.UTF-8
#ENV LC_ALL zh_CN.UTF-8
#ENV LANGUAGE zh_CN.UTF-8
# 便捷操作
RUN echo "alias ll='ls -alF'" >> /root/.bashrc && \
echo "alias la='ls -A'" >> /root/.bashrc && \
echo "alias vi='vim'" >> /root/.bashrc && \
/bin/bash -c "source /root/.bashrc"

View File

@ -0,0 +1,14 @@
set -ex
hubhost=ccr.ccs.tencentyun.com/cube-studio
arr=("tritonserver:21.12-py3" "tritonserver:21.09-py3")
for value in ${arr[@]}
do
echo $value
docker build -t $hubhost/$value --build-arg FROM_IMAGES=nvcr.io/nvidia/$value .
docker push $hubhost/$value
done