diff options
-rw-r--r-- | openrc/Dockerfile | 18 | ||||
-rwxr-xr-x | openrc/entrypoint.sh | 12 | ||||
-rwxr-xr-x | openrc/wait.initd | 4 |
3 files changed, 34 insertions, 0 deletions
diff --git a/openrc/Dockerfile b/openrc/Dockerfile new file mode 100644 index 0000000..49f32cb --- /dev/null +++ b/openrc/Dockerfile @@ -0,0 +1,18 @@ +FROM alpine:3.21 + +# install packages +RUN apk add --no-cache openrc udev-init-scripts-openrc + +# setup openrc +COPY ./wait.initd /etc/init.d/wait +RUN sed -i 's/#rc_sys=""/rc_sys="docker"/' /etc/rc.conf && \ + rc-update add wait + +# remove last run +RUN rm -rf /run/openrc 2>/dev/null +RUN mkdir /run/openrc +RUN touch /run/openrc/softlevel + +# start openrc +COPY ./entrypoint.sh /sbin/entrypoint +ENTRYPOINT ["/sbin/entrypoint"] diff --git a/openrc/entrypoint.sh b/openrc/entrypoint.sh new file mode 100755 index 0000000..ac20887 --- /dev/null +++ b/openrc/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ "$#" = "0" ]; then + step "Starting OpenRC" + rm -rf /run/openrc 2>/dev/null + mkdir /run/openrc + touch /run/openrc/softlevel + exec -a /sbin/openrc /sbin/openrc +else + "$@" +fi + diff --git a/openrc/wait.initd b/openrc/wait.initd new file mode 100755 index 0000000..b033ac1 --- /dev/null +++ b/openrc/wait.initd @@ -0,0 +1,4 @@ +#!/sbin/openrc-run +# this container may need openrc to keep running without any services +# ordinarily that would cause it to stop, so this is a dummy service +start(){ sleep infinity & } |