Skip to main content
Version: release-2.2.0

Business image construction

When the inference logic of mnist's wrapper.py is successfully executed, the project file needs to be packaged to build a service image. The way is as follows:

  • Build the inference environment through python's requirements.txt file. (method used in this example)
  • Build the inference environment through the yaml environment dependencies exported by conda.

Method 1: Modify the Dockerfile in the mnist directory. (The base image has built-in python3.9)

# please visit https://github.com/xfyun/aiges/releases to get stable and suitable iamges.

FROM public.ecr.aws/iflytek-open/aiges-gpu:11.6-1.17-3.9.13-ubuntu1804-v2.0.0-rc6

# do this if you are on the chinese server.

RUN pip3 config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/

ADD requirements.txt /home/aiges

RUN pip install -r /home/aiges/requirements.txt

ADD wrapper /home/aiges

CMD ["sh", "-c", "./AIservice -m=0 -c=aiges.toml -s=svcName -u=http://companion.xfyun.iflytek:6868 -p=AIaaS -g=dx"]

Build the image via docker:

docker build -f Dockerfile -t mnist .

Method 2: Use envd and build the image, and create the build.envd file in the mnist directory.

参考文档-envd

def build():
config.pip_index(url = "https://pypi.tuna.tsinghua.edu.cn/simple")
base(language="python3.8", os="public.ecr.aws/iflytek-open/aiges-gpu:11.6-1.17-3.9.13-ubuntu1804-v2.0.0-rc6") #加载指定的base镜像和python版本
install.python_packages(requirements="requirements.txt")

Build the image via envd:

envd build -t mnist -f build.envd