diff --git a/examples/iowrt/Dockerfile b/examples/iowrt/Dockerfile index f4efd2284d8002b00ad90c402f3d03f1b0b135f1..91b4f63674df524f3cebacdd0951c7d0a280f5a1 100644 --- a/examples/iowrt/Dockerfile +++ b/examples/iowrt/Dockerfile @@ -33,6 +33,10 @@ RUN \ make -j2 && \ make install +# Integrate own applications +COPY src src +RUN make -C /src + # Final image FROM alpine:latest @@ -45,6 +49,11 @@ LABEL vendor=IOPSYS \ RUN apk add --no-cache json-c libxml2 mosquitto mosquitto-clients +# Install own application +COPY --from=builder \ + /src/hello \ + /usr/bin/hello + COPY --from=builder \ /usr/lib/libuci.so \ /usr/lib/libblobmsg_json.so \ diff --git a/examples/iowrt/Makefile b/examples/iowrt/Makefile index 37e3fcdf152832f4783f3ea8e382cb832c64e9ab..78031c45cf4027168516c00b2e910c22777ed540 100644 --- a/examples/iowrt/Makefile +++ b/examples/iowrt/Makefile @@ -7,5 +7,12 @@ all: tar cf iowrt.tar rootfs config.json rm -rf tmp.tar rootfs +lxc: + mkdir -p rootfs + docker buildx build --platform ${PLATFORM} -o type=tar,dest=tmp.tar . + tar xf tmp.tar -C rootfs/ + tar cf iowrt.tar rootfs config + rm -rf tmp.tar rootfs + clean: - rm -rf tmp.tar rootfs iowrt.tar diff --git a/examples/iowrt/config b/examples/iowrt/config new file mode 100644 index 0000000000000000000000000000000000000000..bbc890b9464e4634393eed3651ee2962fd1ddfda --- /dev/null +++ b/examples/iowrt/config @@ -0,0 +1,37 @@ +lxc.net.0.type = veth +lxc.net.0.link = lxcbr0 +lxc.net.0.flags = up +lxc.net.0.hwaddr = 00:16:3e:8e:25:2d + +lxc.rootfs.path = dir:/tmp/lxc/test/rootfs +lxc.uts.name = "test" + +lxc.cap.drop = mac_admin +lxc.cap.drop = mac_override +lxc.cap.drop = sys_admin +lxc.cap.drop = sys_boot +lxc.cap.drop = sys_module +lxc.cap.drop = sys_nice +lxc.cap.drop = sys_pacct +lxc.cap.drop = sys_ptrace +lxc.cap.drop = sys_rawio +lxc.cap.drop = sys_resource +lxc.cap.drop = sys_time +lxc.cap.drop = sys_tty_config +lxc.cap.drop = syslog +lxc.cap.drop = wake_alarm + +lxc.autodev = 1 +lxc.console.buffer.size = auto +lxc.tty.max = 5 +lxc.pty.max = 5 +lxc.mount.auto = cgroup:mixed proc:mixed sys:mixed + +lxc.net.0.type = veth +lxc.net.0.flags = up +lxc.net.0.link = br-lan +lxc.net.0.name = eth0 +lxc.net.0.mtu = 1500 + +lxc.mount.entry = /lib lib none ro,bind 0 0 +lxc.mount.entry = /sys/kernel/security sys/kernel/security none ro,bind,optional 0 0 diff --git a/examples/iowrt/src/Makefile b/examples/iowrt/src/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..76ea9a84e5a8bb80babeb0fdcb2b122651ace59c --- /dev/null +++ b/examples/iowrt/src/Makefile @@ -0,0 +1,7 @@ +PROG:=hello + +all: *.c + gcc -o ${PROG} *.c + +clean: + -@rm ${PROG} diff --git a/examples/iowrt/src/hello.c b/examples/iowrt/src/hello.c new file mode 100644 index 0000000000000000000000000000000000000000..89be92dc382f594f04e273fb91dcd7ab7f5fef12 --- /dev/null +++ b/examples/iowrt/src/hello.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main() +{ + printf("Hello! OCI container.....\n"); + return 0; +}