Initial s6 v3 commit

This commit is contained in:
TheSpad 2022-05-29 17:11:29 +01:00
parent 9932e2d924
commit bcd66ca9d5
No known key found for this signature in database
GPG key ID: 08F06191F4587860
18 changed files with 99 additions and 71 deletions

View file

@ -33,6 +33,29 @@ RUN \
/root-out && \ /root-out && \
sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow
# set version for s6 overlay
ARG S6_OVERLAY_VERSION="3.1.0.1"
ARG S6_OVERLAY_ARCH="x86_64"
# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
# add s6 optional symlinks
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
# copy ci-checks
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
# patch cont-init for docker-mods
COPY patch/ /tmp/patch
RUN patch -u /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-linux-init/skel/rc.init -i /tmp/patch/package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel/rc.init.patch
# Runtime stage # Runtime stage
FROM scratch FROM scratch
COPY --from=rootfs-stage /root-out/ / COPY --from=rootfs-stage /root-out/ /
@ -41,31 +64,18 @@ ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="TheLamer" LABEL maintainer="TheLamer"
# set version for s6 overlay
ARG OVERLAY_VERSION="v2.2.0.3"
ARG OVERLAY_ARCH="amd64"
# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
COPY patch/ /tmp/patch
# environment variables # environment variables
ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \ ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
HOME="/root" \ HOME="/root" \
TERM="xterm" TERM="xterm"
RUN \ RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
curl \
patch \
tar && \
echo "**** install runtime packages ****" && \ echo "**** install runtime packages ****" && \
apk add --no-cache \ apk add --no-cache \
bash \ bash \
ca-certificates \ ca-certificates \
coreutils \ coreutils \
curl \
procps \ procps \
shadow \ shadow \
tzdata && \ tzdata && \
@ -77,11 +87,7 @@ RUN \
/app \ /app \
/config \ /config \
/defaults && \ /defaults && \
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
echo "**** cleanup ****" && \ echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \ rm -rf \
/tmp/* /tmp/*

View file

@ -33,6 +33,29 @@ RUN \
/root-out && \ /root-out && \
sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow
# set version for s6 overlay
ARG S6_OVERLAY_VERSION="3.1.0.1"
ARG S6_OVERLAY_ARCH="x86_64"
# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
# add s6 optional symlinks
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
# copy ci-checks
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
# patch cont-init for docker-mods
COPY patch/ /tmp/patch
RUN patch -u /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-linux-init/skel/rc.init -i /tmp/patch/package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel/rc.init.patch
# Runtime stage # Runtime stage
FROM scratch FROM scratch
COPY --from=rootfs-stage /root-out/ / COPY --from=rootfs-stage /root-out/ /
@ -41,31 +64,18 @@ ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="TheLamer" LABEL maintainer="TheLamer"
# set version for s6 overlay
ARG OVERLAY_VERSION="v2.2.0.3"
ARG OVERLAY_ARCH="aarch64"
# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
COPY patch/ /tmp/patch
# environment variables # environment variables
ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \ ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
HOME="/root" \ HOME="/root" \
TERM="xterm" TERM="xterm"
RUN \ RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
curl \
patch \
tar && \
echo "**** install runtime packages ****" && \ echo "**** install runtime packages ****" && \
apk add --no-cache \ apk add --no-cache \
bash \ bash \
ca-certificates \ ca-certificates \
coreutils \ coreutils \
curl \
procps \ procps \
shadow \ shadow \
tzdata && \ tzdata && \
@ -77,16 +87,12 @@ RUN \
/app \ /app \
/config \ /config \
/defaults && \ /defaults && \
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
echo "**** add qemu ****" && \ echo "**** add qemu ****" && \
curl -o \ curl -o \
/usr/bin/qemu-aarch64-static -L \ /usr/bin/qemu-aarch64-static -L \
"https://lsio-ci.ams3.digitaloceanspaces.com/qemu-aarch64-static" && \ "https://lsio-ci.ams3.digitaloceanspaces.com/qemu-aarch64-static" && \
chmod +x /usr/bin/qemu-aarch64-static && \ chmod +x /usr/bin/qemu-aarch64-static && \
echo "**** cleanup ****" && \ echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \ rm -rf \
/tmp/* /tmp/*

View file

@ -33,6 +33,29 @@ RUN \
/root-out && \ /root-out && \
sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow
# set version for s6 overlay
ARG S6_OVERLAY_VERSION="3.1.0.1"
ARG S6_OVERLAY_ARCH="x86_64"
# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
# add s6 optional symlinks
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
# copy ci-checks
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
# patch cont-init for docker-mods
COPY patch/ /tmp/patch
RUN patch -u /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-linux-init/skel/rc.init -i /tmp/patch/package/admin/s6-overlay-@VERSION@/etc/s6-linux-init/skel/rc.init.patch
# Runtime stage # Runtime stage
FROM scratch FROM scratch
COPY --from=rootfs-stage /root-out/ / COPY --from=rootfs-stage /root-out/ /
@ -41,31 +64,18 @@ ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="TheLamer" LABEL maintainer="TheLamer"
# set version for s6 overlay
ARG OVERLAY_VERSION="v2.2.0.3"
ARG OVERLAY_ARCH="arm"
# add s6 overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
COPY patch/ /tmp/patch
# environment variables # environment variables
ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \ ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
HOME="/root" \ HOME="/root" \
TERM="xterm" TERM="xterm"
RUN \ RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
curl \
patch \
tar && \
echo "**** install runtime packages ****" && \ echo "**** install runtime packages ****" && \
apk add --no-cache \ apk add --no-cache \
bash \ bash \
ca-certificates \ ca-certificates \
coreutils \ coreutils \
curl \
procps \ procps \
shadow \ shadow \
tzdata && \ tzdata && \
@ -77,16 +87,12 @@ RUN \
/app \ /app \
/config \ /config \
/defaults && \ /defaults && \
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
echo "**** add qemu ****" && \ echo "**** add qemu ****" && \
curl -o \ curl -o \
/usr/bin/qemu-arm-static -L \ /usr/bin/qemu-arm-static -L \
"https://lsio-ci.ams3.digitaloceanspaces.com/qemu-arm-static" && \ "https://lsio-ci.ams3.digitaloceanspaces.com/qemu-arm-static" && \
chmod +x /usr/bin/qemu-arm-static && \ chmod +x /usr/bin/qemu-arm-static && \
echo "**** cleanup ****" && \ echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \ rm -rf \
/tmp/* /tmp/*

View file

View file

@ -1,15 +0,0 @@
--- init-stage2 2021-01-20 20:21:41.628300700 -0600
+++ init-stage2_new 2021-01-20 20:23:48.123677700 -0600
@@ -17,6 +17,12 @@
backtick -D 0 -n S6_READ_ONLY_ROOT { printcontenv S6_READ_ONLY_ROOT }
importas -u S6_READ_ONLY_ROOT S6_READ_ONLY_ROOT
+# Docker Mods run logic
+foreground
+{
+ /docker-mods
+}
+
foreground
{
if

View file

@ -0,0 +1,11 @@
--- rc.init 2022-05-20 17:41:11.195721000 -0500
+++ rc.init.patched 2022-05-20 17:41:37.646586700 -0500
@@ -6,6 +6,8 @@
s6-chmod 0755 /run/s6/container_environment
fi
+/docker-mods
+
if profile=`printcontenv S6_RUNTIME_PROFILE` ; then
etc="/etc/cont-profile.d/$profile"
else

View file

@ -1,5 +1,14 @@
#!/usr/bin/with-contenv bash #!/usr/bin/with-contenv bash
# Set executable bit on cont-init and services built into the image
set_legacy_executable_bits() {
mkdir -p /etc/{cont-init.d,services.d}
chmod +x \
/etc/cont-init.d/* \
/etc/services.d/*/* 2> /dev/null || true
}
set_legacy_executable_bits
# Exit if mods is not set # Exit if mods is not set
if [ -z ${DOCKER_MODS+x} ]; then if [ -z ${DOCKER_MODS+x} ]; then
exit 0 exit 0
@ -119,3 +128,6 @@ for DOCKER_MOD in "${DOCKER_MODS[@]}"; do
echo ${SHALAYER} > "/${FILENAME}" echo ${SHALAYER} > "/${FILENAME}"
fi fi
done done
# Set executable bit on cont-init and services that may have been unpacked by mods
set_legacy_executable_bits

0
root/etc/cont-init.d/01-envfile Normal file → Executable file
View file

0
root/etc/cont-init.d/02-tamper-check Normal file → Executable file
View file

0
root/etc/cont-init.d/10-adduser Normal file → Executable file
View file

0
root/etc/cont-init.d/90-custom-folders Normal file → Executable file
View file

0
root/etc/cont-init.d/99-custom-files Normal file → Executable file
View file

View file

@ -0,0 +1 @@
oneshot

View file

@ -0,0 +1 @@
echo "[ls.io-init] done."

View file

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
if [[ -f /var/run/s6/container_environment/UMASK ]] && [[ "$(pwdx $$)" =~ "/run/s6/services/" ]]; then if [[ -f /var/run/s6/container_environment/UMASK ]] && [[ "$(pwdx $$)" =~ "/run/s6/services/" ]]; then
umask $(cat /var/run/s6/container_environment/UMASK) umask $(cat /var/run/s6/container_environment/UMASK)
exec /usr/bin/with-contenvb "$@" exec /command/with-contenv "$@"
else else
exec /usr/bin/with-contenvb "$@" exec /command/with-contenv "$@"
fi fi