Update fish demo with copy_bom tool
Signed-off-by: Zheng, Qi <huaiqing.zq@antgroup.com>
This commit is contained in:
parent
54bc08d094
commit
cbb326e3fd
@ -1,65 +0,0 @@
|
||||
{
|
||||
"resource_limits": {
|
||||
"user_space_size": "512MB",
|
||||
"kernel_space_heap_size": "64MB",
|
||||
"kernel_space_stack_size": "1MB",
|
||||
"max_num_of_threads": 32
|
||||
},
|
||||
"process": {
|
||||
"default_stack_size": "4MB",
|
||||
"default_heap_size": "32MB",
|
||||
"default_mmap_size": "80MB"
|
||||
},
|
||||
"entry_points": [
|
||||
"/bin"
|
||||
],
|
||||
"env": {
|
||||
"default": [
|
||||
"OCCLUM=yes",
|
||||
"HOME=/root"
|
||||
],
|
||||
"untrusted": [
|
||||
]
|
||||
},
|
||||
"metadata": {
|
||||
"product_id": 0,
|
||||
"version_number": 0,
|
||||
"debuggable": true
|
||||
},
|
||||
"mount": [
|
||||
{
|
||||
"target": "/",
|
||||
"type": "unionfs",
|
||||
"options": {
|
||||
"layers": [
|
||||
{
|
||||
"target": "/",
|
||||
"type": "sefs",
|
||||
"source": "./build/mount/__ROOT",
|
||||
"options": {
|
||||
"MAC": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"target": "/",
|
||||
"type": "sefs",
|
||||
"source": "./run/mount/__ROOT"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"target": "/host",
|
||||
"type": "hostfs",
|
||||
"source": "."
|
||||
},
|
||||
{
|
||||
"target": "/proc",
|
||||
"type": "procfs"
|
||||
},
|
||||
{
|
||||
"target": "/dev",
|
||||
"type": "devfs"
|
||||
}
|
||||
]
|
||||
}
|
24
demos/fish/fish.yaml
Normal file
24
demos/fish/fish.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
includes:
|
||||
- base.yaml
|
||||
# fish
|
||||
targets:
|
||||
- target: /usr/bin
|
||||
# copy bins
|
||||
copy:
|
||||
- files:
|
||||
- ../fish-shell/build/fish
|
||||
- ../busybox/busybox
|
||||
- target: /bin
|
||||
# copy script
|
||||
copy:
|
||||
- files:
|
||||
- ../fish_script.sh
|
||||
- ../test_per_process_config.sh
|
||||
# busybox links
|
||||
createlinks:
|
||||
- src: /usr/bin/busybox
|
||||
linkname: cat
|
||||
- src: /usr/bin/busybox
|
||||
linkname: echo
|
||||
- src: /usr/bin/busybox
|
||||
linkname: awk
|
@ -1,19 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
bomfile=${SCRIPT_DIR}/fish.yaml
|
||||
|
||||
rm -rf occlum-instance
|
||||
mkdir occlum-instance && cd occlum-instance
|
||||
occlum init
|
||||
mkdir -p image/usr/bin
|
||||
cp ../Occlum.json .
|
||||
cp ../fish-shell/build/fish image/usr/bin
|
||||
cp ../busybox/busybox image/usr/bin
|
||||
cp ../fish_script.sh image/bin
|
||||
pushd image/bin
|
||||
ln -s /usr/bin/busybox cat
|
||||
ln -s /usr/bin/busybox echo
|
||||
ln -s /usr/bin/busybox awk
|
||||
popd
|
||||
occlum new occlum-instance
|
||||
cd occlum-instance
|
||||
|
||||
new_json="$(jq '.resource_limits.user_space_size = "512MB" |
|
||||
.resource_limits.kernel_space_heap_size = "64MB" |
|
||||
.env.default = [ "OCCLUM=yes", "HOME=/root" ]' Occlum.json)" && \
|
||||
echo "${new_json}" > Occlum.json
|
||||
|
||||
rm -rf image
|
||||
copy_bom -f $bomfile --root image --include-dir /opt/occlum/etc/template
|
||||
|
||||
occlum build
|
||||
echo -e "\nBuild done. Running fish script ..."
|
||||
|
@ -1,28 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
bomfile=${SCRIPT_DIR}/fish.yaml
|
||||
|
||||
option=$1
|
||||
|
||||
rm -rf occlum-test
|
||||
mkdir occlum-test && cd occlum-test
|
||||
occlum init
|
||||
mkdir -p image/usr/bin
|
||||
cp ../Occlum.json .
|
||||
cp ../fish-shell/build/fish image/usr/bin
|
||||
cp ../busybox/busybox image/usr/bin
|
||||
cp ../test_per_process_config.sh image/bin
|
||||
occlum new occlum-test && cd occlum-test
|
||||
|
||||
# Set process memory space size to very small values and will fail when running target script using default configuration
|
||||
new_json="$(jq '.process.default_stack_size = "1MB" |
|
||||
new_json="$(jq '.resource_limits.user_space_size = "512MB" |
|
||||
.resource_limits.kernel_space_heap_size= "64MB" |
|
||||
.process.default_stack_size = "1MB" |
|
||||
.process.default_heap_size = "1MB" |
|
||||
.process.default_mmap_size = "10MB"' Occlum.json)" && \
|
||||
.process.default_mmap_size = "10MB" |
|
||||
.env.default = [ "OCCLUM=yes", "HOME=/root" ]' Occlum.json)" && \
|
||||
echo "${new_json}" > Occlum.json
|
||||
|
||||
pushd image/bin
|
||||
ln -s /usr/bin/busybox cat
|
||||
ln -s /usr/bin/busybox echo
|
||||
ln -s /usr/bin/busybox awk
|
||||
popd
|
||||
rm -rf image
|
||||
copy_bom -f $bomfile --root image --include-dir /opt/occlum/etc/template
|
||||
|
||||
# If `--without-ulimit` is specified, run without ulimit command and thus will fail
|
||||
if [[ $1 == "--without-ulimit" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user