detee-sgx/build_server.sh

34 lines
952 B
Bash
Executable File

#!/bin/bash
set -e
SCRIPT=$0
EXAMPLE=$1
if [ $# -eq 0 ] || [ "$EXAMPLE" != "https" ] && [ "$EXAMPLE" != "grpcs" ]; then
echo "usage: $SCRIPT https|grpcs"
exit 1
fi
FEATURES=$(if [ "$EXAMPLE" == "https" ]; then echo "actix-web,occlum"; else echo "tonic,occlum"; fi)
occlum-cargo build --example mratls_"${EXAMPLE}"_server --features="$FEATURES"
strip target/x86_64-unknown-linux-musl/debug/examples/mratls_"${EXAMPLE}"_server
cat > server.yaml <<EOF
includes:
- base.yaml
targets:
- target: /bin
copy:
- files:
- ../target/x86_64-unknown-linux-musl/debug/examples/mratls_${EXAMPLE}_server
EOF
rm -rf server_instance && mkdir server_instance && cd server_instance
occlum init && rm -rf image
copy_bom -f ../server.yaml --root image --include-dir /opt/occlum/etc/template
occlum build --sign-key ../examples/signing_key.pem --enable-edmm Y
occlum package --debug server.tar.gz
occlum run /bin/mratls_${EXAMPLE}_server