Update sqlite demo with copy_bom tool

Signed-off-by: Zheng, Qi <huaiqing.zq@antgroup.com>
This commit is contained in:
Zheng, Qi 2021-09-26 11:57:38 +08:00 committed by Zongmin.Gu
parent 09b79083b2
commit a5e74f2769
2 changed files with 21 additions and 6 deletions

@ -1,7 +1,12 @@
#!/bin/bash
set -e
DEMO=sqlite_demo
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
bomfile=${SCRIPT_DIR}/sqlite.yaml
export DEMO=sqlite_demo
export SPEEDTEST=speedtest1
SQL_DB=/root/company.db
SQL_STMT="CREATE TABLE COMPANY ( \
ID INT PRIMARY KEY NOT NULL, \
@ -11,7 +16,7 @@ SQL_STMT="CREATE TABLE COMPANY ( \
SALARY REAL ); \
INSERT INTO COMPANY VALUES ( 1, 'Kris', 27, 'California', 16000.00 ); \
SELECT * FROM COMPANY;"
SPEEDTEST=speedtest1
if [ ! -e $DEMO ];then
echo "Error: cannot stat '$DEMO'"
@ -26,13 +31,13 @@ if [ ! -e $SPEEDTEST ];then
fi
# 1. Init Occlum Workspace
rm -rf occlum_instance && mkdir occlum_instance
rm -rf occlum_instance && occlum new occlum_instance
cd occlum_instance
occlum init
# 2. Copy files into Occlum Workspace and build
cp ../$DEMO image/bin
cp ../$SPEEDTEST image/bin
rm -rf image
copy_bom -f $bomfile --root image --include-dir /opt/occlum/etc/template
occlum build
# 3. Run the demo

10
demos/sqlite/sqlite.yaml Normal file

@ -0,0 +1,10 @@
includes:
- base.yaml
# sqlite
targets:
# copy bins
- target: /bin
copy:
- files:
- ../$DEMO
- ../$SPEEDTEST