From bb17ee2b2539df5fdb4f5c7ed360e5061c188f6e Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Fri, 11 Apr 2025 23:22:53 -0400 Subject: openrc --- openrc/Dockerfile | 18 ++++++++++++++++++ openrc/entrypoint.sh | 12 ++++++++++++ openrc/wait.initd | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 openrc/Dockerfile create mode 100755 openrc/entrypoint.sh create mode 100755 openrc/wait.initd 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 & } -- cgit v1.2.3-freya