Skip to content
Snippets Groups Projects
Commit 45ac1e43 authored by Vivek Dutta's avatar Vivek Dutta
Browse files

example: iowrt oci container with self code

parent 505f7466
No related branches found
No related tags found
1 merge request!85Example lxc tar
Pipeline #103686 passed
...@@ -33,6 +33,10 @@ RUN \ ...@@ -33,6 +33,10 @@ RUN \
make -j2 && \ make -j2 && \
make install make install
# Integrate own applications
COPY src src
RUN make -C /src
# Final image # Final image
FROM alpine:latest FROM alpine:latest
...@@ -45,6 +49,11 @@ LABEL vendor=IOPSYS \ ...@@ -45,6 +49,11 @@ LABEL vendor=IOPSYS \
RUN apk add --no-cache json-c libxml2 mosquitto mosquitto-clients 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 \ COPY --from=builder \
/usr/lib/libuci.so \ /usr/lib/libuci.so \
/usr/lib/libblobmsg_json.so \ /usr/lib/libblobmsg_json.so \
......
...@@ -7,5 +7,12 @@ all: ...@@ -7,5 +7,12 @@ all:
tar cf iowrt.tar rootfs config.json tar cf iowrt.tar rootfs config.json
rm -rf tmp.tar rootfs 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: clean:
- rm -rf tmp.tar rootfs iowrt.tar - rm -rf tmp.tar rootfs iowrt.tar
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
PROG:=hello
all: *.c
gcc -o ${PROG} *.c
clean:
-@rm ${PROG}
#include <stdio.h>
int main()
{
printf("Hello! OCI container.....\n");
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment