From 6d60483a1ea526b1879399f6dece99b576249058 Mon Sep 17 00:00:00 2001 From: jiangjianfeng Date: Fri, 17 Sep 2021 14:44:23 +0800 Subject: [PATCH] Modify hello_c demo with copy_bom --- .github/workflows/demo_test.yml | 10 ++++++---- demos/hello_c/README.md | 4 ++-- demos/hello_c/hello.yaml | 7 +++++++ 3 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 demos/hello_c/hello.yaml diff --git a/.github/workflows/demo_test.yml b/.github/workflows/demo_test.yml index 013d1826..366efbaa 100644 --- a/.github/workflows/demo_test.yml +++ b/.github/workflows/demo_test.yml @@ -30,16 +30,18 @@ jobs: - name: C test run: docker exec language_support_test bash -c "cd /root/occlum/demos/hello_c && make; occlum new occlum_instance; - cp hello_world occlum_instance/image/bin; - cd occlum_instance && SGX_MODE=SIM occlum build; + cd occlum_instance && rm -rf image; + copy_bom -f ../hello.yaml --root image --include-dir /opt/occlum/etc/template; + SGX_MODE=SIM occlum build; occlum run /bin/hello_world" - name: C with encrypted image test run: docker exec language_support_test bash -c "cd /root/occlum/demos/hello_c && make; rm -rf occlum_instance && occlum new occlum_instance; occlum gen-image-key occlum_instance/image_key; - cp hello_world occlum_instance/image/bin; - cd occlum_instance && SGX_MODE=SIM occlum build --image-key ./image_key --buildin-image-key; + cd occlum_instance && rm -rf image; + copy_bom -f ../hello.yaml --root image --include-dir /opt/occlum/etc/template; + SGX_MODE=SIM occlum build --image-key ./image_key --buildin-image-key; occlum run /bin/hello_world" - name: C++ test diff --git a/demos/hello_c/README.md b/demos/hello_c/README.md index ec176334..30612def 100644 --- a/demos/hello_c/README.md +++ b/demos/hello_c/README.md @@ -24,8 +24,8 @@ Either way, the resulting `hello_world` can be found in the current directory. 3. Run `hello_world` on Occlum ``` mkdir occlum_workspace && cd occlum_workspace -occlum init -cp ../hello_world image/bin +occlum init && rm -rf image +copy_bom -f ../hello.yaml --root image --include-dir /opt/occlum/etc/template occlum build occlum run /bin/hello_world ``` diff --git a/demos/hello_c/hello.yaml b/demos/hello_c/hello.yaml new file mode 100644 index 00000000..0171a4c3 --- /dev/null +++ b/demos/hello_c/hello.yaml @@ -0,0 +1,7 @@ +includes: + - base.yaml +targets: + - target: /bin + copy: + - files: + - ../hello_world