Modify java demo with copy_bom
This commit is contained in:
parent
d3b4b10d4a
commit
da4669b8c4
9
demos/java/hello_world.yaml
Normal file
9
demos/java/hello_world.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
includes:
|
||||||
|
- base.yaml
|
||||||
|
- java-11-alibaba-dragonwell.yaml
|
||||||
|
targets:
|
||||||
|
# copy java class file
|
||||||
|
- target: /
|
||||||
|
copy:
|
||||||
|
- files:
|
||||||
|
- ../hello_world/Main.class
|
15
demos/java/process_builder.yaml
Normal file
15
demos/java/process_builder.yaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
includes:
|
||||||
|
- base.yaml
|
||||||
|
- java-11-alibaba-dragonwell.yaml
|
||||||
|
targets:
|
||||||
|
# copy java class file
|
||||||
|
- target: /
|
||||||
|
copy:
|
||||||
|
- files:
|
||||||
|
- ../processBuilder/processBuilder.class
|
||||||
|
# copy date used by processBuilder
|
||||||
|
- target: /bin
|
||||||
|
copy:
|
||||||
|
- files:
|
||||||
|
- /bin/date
|
||||||
|
|
@ -36,11 +36,8 @@ init_instance() {
|
|||||||
|
|
||||||
build_web() {
|
build_web() {
|
||||||
# Copy JVM and JAR file into Occlum instance and build
|
# Copy JVM and JAR file into Occlum instance and build
|
||||||
mkdir -p image/usr/lib/jvm
|
rm -rf image
|
||||||
cp -r /opt/occlum/toolchains/jvm/java-11-alibaba-dragonwell image/usr/lib/jvm
|
copy_bom -f ../webserver.yaml --root image --include-dir /opt/occlum/etc/template
|
||||||
cp /usr/local/occlum/x86_64-linux-musl/lib/libz.so.1 image/lib
|
|
||||||
mkdir -p image/usr/lib/spring
|
|
||||||
cp ../${jar_path} image/usr/lib/spring/
|
|
||||||
occlum build
|
occlum build
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,10 +53,8 @@ run_web() {
|
|||||||
|
|
||||||
build_hello() {
|
build_hello() {
|
||||||
# Copy JVM and class file into Occlum instance and build
|
# Copy JVM and class file into Occlum instance and build
|
||||||
mkdir -p image/usr/lib/jvm
|
rm -rf image
|
||||||
cp -r /opt/occlum/toolchains/jvm/java-11-alibaba-dragonwell image/usr/lib/jvm
|
copy_bom -f ../hello_world.yaml --root image --include-dir /opt/occlum/etc/template
|
||||||
cp /usr/local/occlum/x86_64-linux-musl/lib/libz.so.1 image/lib
|
|
||||||
cp ../${hello} image
|
|
||||||
occlum build
|
occlum build
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,11 +69,8 @@ run_hello() {
|
|||||||
|
|
||||||
build_processBuilder() {
|
build_processBuilder() {
|
||||||
# Copy JVM and class file into Occlum instance and build
|
# Copy JVM and class file into Occlum instance and build
|
||||||
mkdir -p image/usr/lib/jvm
|
rm -rf image
|
||||||
cp -r /opt/occlum/toolchains/jvm/java-11-alibaba-dragonwell image/usr/lib/jvm
|
copy_bom -f ../process_builder.yaml --root image --include-dir /opt/occlum/etc/template
|
||||||
cp /usr/local/occlum/x86_64-linux-musl/lib/libz.so.1 image/lib
|
|
||||||
cp ../${app} image
|
|
||||||
cp /bin/date image/bin/
|
|
||||||
# Need bigger user space size for multiprocess
|
# Need bigger user space size for multiprocess
|
||||||
new_json="$(jq '.resource_limits.user_space_size = "6000MB"' Occlum.json)" && \
|
new_json="$(jq '.resource_limits.user_space_size = "6000MB"' Occlum.json)" && \
|
||||||
echo "${new_json}" > Occlum.json
|
echo "${new_json}" > Occlum.json
|
||||||
@ -95,6 +87,12 @@ run_processBuilder() {
|
|||||||
-Djdk.lang.Process.launchMechanism=posix_spawn processBuilder
|
-Djdk.lang.Process.launchMechanism=posix_spawn processBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check if the libz softlink exists. If not, create the softlink to enable autodep for java
|
||||||
|
libz_file=/lib/libz.so.1
|
||||||
|
if [ ! -f ${libz_file} ];then
|
||||||
|
ln -sf /usr/local/occlum/x86_64-linux-musl/lib/libz.so.1 ${libz_file}
|
||||||
|
fi
|
||||||
|
|
||||||
arg=$1
|
arg=$1
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
web_app)
|
web_app)
|
||||||
|
9
demos/java/webserver.yaml
Normal file
9
demos/java/webserver.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
includes:
|
||||||
|
- base.yaml
|
||||||
|
- java-11-alibaba-dragonwell.yaml
|
||||||
|
targets:
|
||||||
|
# copy the web server
|
||||||
|
- target: /usr/lib/spring
|
||||||
|
copy:
|
||||||
|
- files:
|
||||||
|
- ../gs-messaging-stomp-websocket/complete/target/gs-messaging-stomp-websocket-0.1.0.jar
|
@ -41,3 +41,6 @@ EOF
|
|||||||
|
|
||||||
chmod +x ${INSTALL_DIR}/bin/occlum-java
|
chmod +x ${INSTALL_DIR}/bin/occlum-java
|
||||||
chmod +x ${INSTALL_DIR}/bin/occlum-javac
|
chmod +x ${INSTALL_DIR}/bin/occlum-javac
|
||||||
|
|
||||||
|
# create softlink for libz to enable autodep for java
|
||||||
|
ln -sf /usr/local/occlum/x86_64-linux-musl/lib/libz.so.1 /lib/libz.so.1
|
||||||
|
Loading…
Reference in New Issue
Block a user