From a871984e5be0b9ffbf06afe02f359ad5a43997aa Mon Sep 17 00:00:00 2001 From: "Zheng, Qi" Date: Mon, 8 Aug 2022 15:48:14 +0800 Subject: [PATCH] [example] Add tag option for docker image build and run --- example/build_container_images.sh | 5 +++-- example/run_container.sh | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/example/build_container_images.sh b/example/build_container_images.sh index 19f0c524..392f5f81 100755 --- a/example/build_container_images.sh +++ b/example/build_container_images.sh @@ -3,17 +3,18 @@ set -e script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" registry=${1:-demo} +tag=${2:-latest} pushd ${script_dir} echo "Build Occlum init-ra Server runtime container image ..." ./container/build_image.sh \ -i ./occlum_server/occlum_instance.tar.gz \ - -n init_ra_server -r ${registry} + -n init_ra_server -r ${registry} -g ${tag} echo "Build Occlum Tensorflow-serving runtime container image ..." ./container/build_image.sh \ -i ./occlum_tf/occlum_instance.tar.gz \ - -n tf_demo -r ${registry} + -n tf_demo -r ${registry} -g ${tag} popd diff --git a/example/run_container.sh b/example/run_container.sh index 55c01d96..fb5b1238 100755 --- a/example/run_container.sh +++ b/example/run_container.sh @@ -7,6 +7,7 @@ grpc_domain=localhost grpc_port=50051 pccs_url="https://localhost:8081/sgx/certification/v3/" registry="demo" +tag="latest" function usage { cat << EOM @@ -22,12 +23,13 @@ EOM } function process_args { - while getopts ":s:p:u:r:h" option; do + while getopts ":s:p:u:r:g:h" option; do case "${option}" in s) grpc_domain=${OPTARG};; p) grpc_port=${OPTARG};; u) pccs_url=${OPTARG};; r) registry=${OPTARG};; + g) tag=${OPTARG};; h) usage;; esac done @@ -40,7 +42,7 @@ echo "Start GRPC server on backgound ..." docker run --network host \ --device /dev/sgx/enclave --device /dev/sgx/provision \ --env PCCS_URL=${pccs_url} \ - ${registry}/init_ra_server \ + ${registry}/init_ra_server:${tag} \ occlum run /bin/server ${grpc_domain}:${grpc_port} & sleep 3 @@ -50,7 +52,7 @@ echo "Start Tensorflow-Serving on backgound ..." docker run --network host \ --device /dev/sgx/enclave --device /dev/sgx/provision \ --env PCCS_URL=${pccs_url} \ - ${registry}/tf_demo \ + ${registry}/tf_demo:${tag} \ taskset -c 0,1 occlum run /bin/tensorflow_model_server \ --model_name=INCEPTION --model_base_path=/model/INCEPTION/INCEPTION \ --port=9000 --ssl_config_file="/etc/tf_ssl.cfg" &