[example] Add tag option for docker image build and run
This commit is contained in:
		
							parent
							
								
									a20b52bae3
								
							
						
					
					
						commit
						a871984e5b
					
				| @ -3,17 +3,18 @@ set -e | |||||||
| 
 | 
 | ||||||
| script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}"  )" >/dev/null 2>&1 && pwd )" | script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}"  )" >/dev/null 2>&1 && pwd )" | ||||||
| registry=${1:-demo} | registry=${1:-demo} | ||||||
|  | tag=${2:-latest} | ||||||
| 
 | 
 | ||||||
| pushd ${script_dir} | pushd ${script_dir} | ||||||
| 
 | 
 | ||||||
| echo "Build Occlum init-ra Server runtime container image ..." | echo "Build Occlum init-ra Server runtime container image ..." | ||||||
| ./container/build_image.sh \ | ./container/build_image.sh \ | ||||||
|     -i ./occlum_server/occlum_instance.tar.gz \ |     -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 ..." | echo "Build Occlum Tensorflow-serving runtime container image ..." | ||||||
| ./container/build_image.sh \ | ./container/build_image.sh \ | ||||||
|     -i ./occlum_tf/occlum_instance.tar.gz \ |     -i ./occlum_tf/occlum_instance.tar.gz \ | ||||||
|     -n tf_demo -r ${registry} |     -n tf_demo -r ${registry} -g ${tag} | ||||||
| 
 | 
 | ||||||
| popd | popd | ||||||
|  | |||||||
| @ -7,6 +7,7 @@ grpc_domain=localhost | |||||||
| grpc_port=50051 | grpc_port=50051 | ||||||
| pccs_url="https://localhost:8081/sgx/certification/v3/" | pccs_url="https://localhost:8081/sgx/certification/v3/" | ||||||
| registry="demo" | registry="demo" | ||||||
|  | tag="latest" | ||||||
| 
 | 
 | ||||||
| function usage { | function usage { | ||||||
|     cat << EOM |     cat << EOM | ||||||
| @ -22,12 +23,13 @@ EOM | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function process_args { | 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 |         case "${option}" in | ||||||
|             s) grpc_domain=${OPTARG};; |             s) grpc_domain=${OPTARG};; | ||||||
|             p) grpc_port=${OPTARG};; |             p) grpc_port=${OPTARG};; | ||||||
|             u) pccs_url=${OPTARG};; |             u) pccs_url=${OPTARG};; | ||||||
|             r) registry=${OPTARG};; |             r) registry=${OPTARG};; | ||||||
|  |             g) tag=${OPTARG};; | ||||||
|             h) usage;; |             h) usage;; | ||||||
|         esac |         esac | ||||||
|     done |     done | ||||||
| @ -40,7 +42,7 @@ echo "Start GRPC server on backgound ..." | |||||||
| docker run --network host \ | docker run --network host \ | ||||||
|         --device /dev/sgx/enclave --device /dev/sgx/provision \ |         --device /dev/sgx/enclave --device /dev/sgx/provision \ | ||||||
|         --env PCCS_URL=${pccs_url} \ |         --env PCCS_URL=${pccs_url} \ | ||||||
|         ${registry}/init_ra_server \ |         ${registry}/init_ra_server:${tag} \ | ||||||
|         occlum run /bin/server ${grpc_domain}:${grpc_port} & |         occlum run /bin/server ${grpc_domain}:${grpc_port} & | ||||||
| 
 | 
 | ||||||
| sleep 3 | sleep 3 | ||||||
| @ -50,7 +52,7 @@ echo "Start Tensorflow-Serving on backgound ..." | |||||||
| docker run --network host \ | docker run --network host \ | ||||||
|         --device /dev/sgx/enclave --device /dev/sgx/provision \ |         --device /dev/sgx/enclave --device /dev/sgx/provision \ | ||||||
|         --env PCCS_URL=${pccs_url} \ |         --env PCCS_URL=${pccs_url} \ | ||||||
|         ${registry}/tf_demo \ |         ${registry}/tf_demo:${tag} \ | ||||||
|         taskset -c 0,1 occlum run /bin/tensorflow_model_server \ |         taskset -c 0,1 occlum run /bin/tensorflow_model_server \ | ||||||
|         --model_name=INCEPTION --model_base_path=/model/INCEPTION/INCEPTION \ |         --model_name=INCEPTION --model_base_path=/model/INCEPTION/INCEPTION \ | ||||||
|         --port=9000 --ssl_config_file="/etc/tf_ssl.cfg" & |         --port=9000 --ssl_config_file="/etc/tf_ssl.cfg" & | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user