Seperate ssl generation with environment preparation

This commit is contained in:
ClawSeven 2021-08-25 14:20:47 +08:00 committed by Zongmin.Gu
parent 29eed82a7e
commit 136c2cca95
4 changed files with 29 additions and 6 deletions

@ -176,6 +176,7 @@ jobs:
push: true push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-python tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-python
Build_tf_serving_image: Build_tf_serving_image:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
if: github.event.inputs.image_name == 'tf_serving' if: github.event.inputs.image_name == 'tf_serving'
@ -187,6 +188,11 @@ jobs:
- name: Get occlum version - name: Get occlum version
run: echo "OCCLUM_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV; run: echo "OCCLUM_VERSION=$(grep 'Version =' src/pal/include/occlum_version.h | awk '{print $4}')" >> $GITHUB_ENV;
- name: Get branch name
# GITHUB_REF=refs/heads/branch-name
# ${GITHUB_REF##*/} == branch-name
run: echo "OCCLUM_BRANCH=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV;
# Because "Build and push" step `context` field can't be subdir, # Because "Build and push" step `context` field can't be subdir,
# we need to copy files needed by dockerfile to root dir of the project # we need to copy files needed by dockerfile to root dir of the project
- name: Copy context for docker build - name: Copy context for docker build
@ -211,6 +217,8 @@ jobs:
context: . context: .
file: ./tools/docker/ci/Dockerfile.tf_serving file: ./tools/docker/ci/Dockerfile.tf_serving
platforms: linux/amd64 platforms: linux/amd64
build-args: OCCLUM_VERSION=${{ env.OCCLUM_VERSION }} build-args: |
"OCCLUM_VERSION=${{ env.OCCLUM_VERSION }}"
"OCCLUM_BRANCH=${{ env.OCCLUM_BRANCH }}"
push: true push: true
tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-tf_serving tags: occlumbackup/occlum:${{ github.event.inputs.tag }}-ubuntu18.04-tf_serving

@ -10,12 +10,16 @@ TensorFlow Serving is a flexible, high-performance serving system for machine le
#### Executing the Tensorflow serving in Occlum #### Executing the Tensorflow serving in Occlum
The following command will download the Resnet50 model and convert the model format. It also will generate the TLS key and certificates for localhost( server domain name). The server.crt will be used by client. The sever.key and ssl.cfg is used by TF serving. The following command will download the Resnet50 model and convert the model format.
``` ```
./prepare_model_and_env.sh ./prepare_model_and_env.sh
``` ```
The following command will generate the TLS key and certificates for localhost( server domain name). The server.crt will be used by client. The sever.key and ssl.cfg is used by TF serving.
```
./generate_ssl_config.sh localhost
```
Run the Tensorflow Serving in occlum. Run the Tensorflow Serving in occlum.
``` ```

@ -4,5 +4,3 @@ pip3 install --upgrade pip
pip3 install --upgrade tensorflow==2.4 pip3 install --upgrade tensorflow==2.4
./download_model.sh ./download_model.sh
python3 ./model_graph_to_saved_model.py --import_path ./models/resnet50-v15-fp32/resnet50-v15-fp32.pb --export_dir ./resnet50-v15-fp32 --model_version 1 --inputs input --outputs predict python3 ./model_graph_to_saved_model.py --import_path ./models/resnet50-v15-fp32/resnet50-v15-fp32.pb --export_dir ./resnet50-v15-fp32 --model_version 1 --inputs input --outputs predict
./generate_ssl_config.sh localhost

@ -38,3 +38,16 @@ LABEL maintainer="Zehuan Li <lizehuan.lzh@antgroup.com>"
WORKDIR /root WORKDIR /root
COPY --from=binary_build /usr/local/bin/tensorflow_model_server /root/tensorflow_model_server COPY --from=binary_build /usr/local/bin/tensorflow_model_server /root/tensorflow_model_server
ARG OCCLUM_BRANCH
RUN apt-get update && apt-get install git && \
git clone -b $OCCLUM_BRANCH git://github.com/occlum/occlum.git && \
cd occlum && \
cd demos/tensorflow/tensorflow_serving && \
./prepare_model_and_env.sh && \
cd client && \
./prepare_client_env.sh && \
mv ../resnet50-v15-fp32/ /root && \
rm -rf /root/occlum
WORKDIR /root