Skip to content

Commit 2ede6ee

Browse files
authored
Merge pull request #4 from linuxserver/s6-3.1.0.1-fedora
2 parents f984ca4 + fe375d0 commit 2ede6ee

File tree

20 files changed

+126
-74
lines changed

20 files changed

+126
-74
lines changed

Dockerfile

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ RUN \
1111
curl \
1212
git \
1313
jq \
14+
patch \
15+
tar \
1416
tzdata \
1517
xz
1618

@@ -23,6 +25,29 @@ RUN \
2325
/root-out && \
2426
sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow
2527

28+
# set version for s6 overlay
29+
ARG S6_OVERLAY_VERSION="3.1.0.1"
30+
ARG S6_OVERLAY_ARCH="x86_64"
31+
32+
# add s6 overlay
33+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
34+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz
35+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
36+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
37+
38+
# add s6 optional symlinks
39+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
40+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
41+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
42+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
43+
44+
# copy ci-checks
45+
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
46+
47+
# patch cont-init for docker-mods
48+
COPY patch/ /tmp/patch
49+
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
50+
2651
# Runtime stage
2752
FROM scratch
2853
COPY --from=rootfs-stage /root-out/ /
@@ -31,19 +56,11 @@ ARG VERSION
3156
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
3257
LABEL maintainer="TheLamer"
3358

34-
# set version for s6 overlay
35-
ARG OVERLAY_VERSION="v2.2.0.3"
36-
ARG OVERLAY_ARCH="amd64"
37-
38-
# add s6 overlay
39-
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
40-
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
41-
COPY patch/ /tmp/patch
42-
4359
# environment variables
4460
ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
4561
HOME="/root" \
46-
TERM="xterm"
62+
TERM="xterm" \
63+
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
4764

4865
RUN \
4966
echo "**** install base packages ****" && \
@@ -52,7 +69,6 @@ RUN \
5269
coreutils \
5370
findutils \
5471
hostname \
55-
patch \
5672
procps \
5773
shadow \
5874
tzdata \
@@ -64,11 +80,7 @@ RUN \
6480
/app \
6581
/config \
6682
/defaults && \
67-
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
68-
patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
6983
echo "**** cleanup ****" && \
70-
dnf remove -y \
71-
patch && \
7284
dnf autoremove -y && \
7385
dnf clean all && \
7486
rm -rf \

Dockerfile.aarch64

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ RUN \
1111
curl \
1212
git \
1313
jq \
14+
patch \
15+
tar \
1416
tzdata \
1517
xz
1618

@@ -23,6 +25,29 @@ RUN \
2325
/root-out && \
2426
sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow
2527

28+
# set version for s6 overlay
29+
ARG S6_OVERLAY_VERSION="3.1.0.1"
30+
ARG S6_OVERLAY_ARCH="aarch64"
31+
32+
# add s6 overlay
33+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
34+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz
35+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
36+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
37+
38+
# add s6 optional symlinks
39+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
40+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
41+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
42+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
43+
44+
# copy ci-checks
45+
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
46+
47+
# patch cont-init for docker-mods
48+
COPY patch/ /tmp/patch
49+
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
50+
2651
# Runtime stage
2752
FROM scratch
2853
COPY --from=rootfs-stage /root-out/ /
@@ -31,19 +56,11 @@ ARG VERSION
3156
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
3257
LABEL maintainer="TheLamer"
3358

34-
# set version for s6 overlay
35-
ARG OVERLAY_VERSION="v2.2.0.3"
36-
ARG OVERLAY_ARCH="aarch64"
37-
38-
# add s6 overlay
39-
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
40-
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
41-
COPY patch/ /tmp/patch
42-
4359
# environment variables
4460
ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
4561
HOME="/root" \
46-
TERM="xterm"
62+
TERM="xterm" \
63+
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
4764

4865
RUN \
4966
echo "**** install base packages ****" && \
@@ -52,7 +69,6 @@ RUN \
5269
coreutils \
5370
findutils \
5471
hostname \
55-
patch \
5672
procps \
5773
shadow \
5874
tzdata \
@@ -64,11 +80,7 @@ RUN \
6480
/app \
6581
/config \
6682
/defaults && \
67-
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
68-
patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
6983
echo "**** cleanup ****" && \
70-
dnf remove -y \
71-
patch && \
7284
dnf autoremove -y && \
7385
dnf clean all && \
7486
rm -rf \

Dockerfile.armhf

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ RUN \
1111
curl \
1212
git \
1313
jq \
14+
patch \
15+
tar \
1416
tzdata \
1517
xz
1618

@@ -23,6 +25,29 @@ RUN \
2325
/root-out && \
2426
sed -i -e 's/^root::/root:!:/' /root-out/etc/shadow
2527

28+
# set version for s6 overlay
29+
ARG S6_OVERLAY_VERSION="3.1.0.1"
30+
ARG S6_OVERLAY_ARCH="armhf"
31+
32+
# add s6 overlay
33+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
34+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-noarch.tar.xz
35+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
36+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
37+
38+
# add s6 optional symlinks
39+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-noarch.tar.xz /tmp
40+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-noarch.tar.xz
41+
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-symlinks-arch.tar.xz /tmp
42+
RUN tar -C /root-out -Jxpf /tmp/s6-overlay-symlinks-arch.tar.xz
43+
44+
# copy ci-checks
45+
COPY ci-check/ /root-out/package/admin/s6-overlay-${S6_OVERLAY_VERSION}/etc/s6-rc/sources/top/contents.d
46+
47+
# patch cont-init for docker-mods
48+
COPY patch/ /tmp/patch
49+
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
50+
2651
# Runtime stage
2752
FROM scratch
2853
COPY --from=rootfs-stage /root-out/ /
@@ -31,19 +56,11 @@ ARG VERSION
3156
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
3257
LABEL maintainer="TheLamer"
3358

34-
# set version for s6 overlay
35-
ARG OVERLAY_VERSION="v2.2.0.3"
36-
ARG OVERLAY_ARCH="arm"
37-
38-
# add s6 overlay
39-
ADD https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}-installer /tmp/
40-
RUN chmod +x /tmp/s6-overlay-${OVERLAY_ARCH}-installer && /tmp/s6-overlay-${OVERLAY_ARCH}-installer / && rm /tmp/s6-overlay-${OVERLAY_ARCH}-installer
41-
COPY patch/ /tmp/patch
42-
4359
# environment variables
4460
ENV PS1="$(whoami)@$(hostname):$(pwd)\\$ " \
4561
HOME="/root" \
46-
TERM="xterm"
62+
TERM="xterm" \
63+
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="0"
4764

4865
RUN \
4966
echo "**** install base packages ****" && \
@@ -52,7 +69,6 @@ RUN \
5269
coreutils \
5370
findutils \
5471
hostname \
55-
patch \
5672
procps \
5773
shadow \
5874
tzdata \
@@ -64,11 +80,7 @@ RUN \
6480
/app \
6581
/config \
6682
/defaults && \
67-
mv /usr/bin/with-contenv /usr/bin/with-contenvb && \
68-
patch -u /etc/s6/init/init-stage2 -i /tmp/patch/etc/s6/init/init-stage2.patch && \
6983
echo "**** cleanup ****" && \
70-
dnf remove -y \
71-
patch && \
7284
dnf autoremove -y && \
7385
dnf clean all && \
7486
rm -rf \

ci-check/99-ci-service-check

Whitespace-only changes.

patch/etc/s6/init/init-stage2.patch

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- rc.init 2022-05-20 17:41:11.195721000 -0500
2+
+++ rc.init.patched 2022-05-20 17:41:37.646586700 -0500
3+
@@ -6,6 +6,8 @@
4+
s6-chmod 0755 /run/s6/container_environment
5+
fi
6+
7+
+/docker-mods
8+
+
9+
if profile=`printcontenv S6_RUNTIME_PROFILE` ; then
10+
etc="/etc/cont-profile.d/$profile"
11+
else

root/docker-mods

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#!/usr/bin/with-contenv bash
22

3+
# Set executable bit on cont-init and services built into the image
4+
set_legacy_executable_bits() {
5+
mkdir -p /etc/{cont-init.d,services.d}
6+
chmod +x \
7+
/etc/cont-init.d/* \
8+
/etc/services.d/*/* 2> /dev/null || true
9+
}
10+
set_legacy_executable_bits
11+
312
# Exit if mods is not set
413
if [ -z ${DOCKER_MODS+x} ]; then
514
exit 0
@@ -9,18 +18,18 @@ fi
918
if [ ! -f /usr/bin/curl ] || [ ! -f /usr/bin/jq ]; then
1019
echo "[mod-init] Curl/JQ was not found on this system for Docker mods installing"
1120
if [ -f /usr/bin/apt ]; then
12-
## Ubuntu
21+
# Ubuntu
1322
apt-get update
1423
apt-get install --no-install-recommends -y \
1524
curl \
1625
jq
1726
elif [ -f /sbin/apk ]; then
18-
## Alpine
27+
# Alpine
1928
apk add --no-cache \
2029
curl \
2130
jq
2231
elif [ -f /usr/bin/dnf ]; then
23-
## Fedora
32+
# Fedora
2433
dnf install -y --setopt=install_weak_deps=False --best install \
2534
curl \
2635
jq
@@ -32,14 +41,14 @@ fi
3241
# Use different filtering depending on URL
3342
get_blob_sha () {
3443
if [[ $1 == "ghcr" ]]; then
35-
curl \
44+
curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
3645
--silent \
3746
--location \
3847
--request GET \
3948
--header "Authorization: Bearer $2" \
4049
$3 | jq -r '.layers[0].digest'
4150
else
42-
curl \
51+
curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
4352
--silent \
4453
--location \
4554
--request GET \
@@ -99,7 +108,7 @@ for DOCKER_MOD in "${DOCKER_MODS[@]}"; do
99108
echo "[mod-init] Applying ${DOCKER_MOD} files to container"
100109
# Get Dockerhub token for api operations
101110
TOKEN=\
102-
"$(curl \
111+
"$(curl -f --retry 10 --retry-max-time 60 --retry-connrefused \
103112
--silent \
104113
--header 'GET' \
105114
"${AUTH_URL}" \
@@ -112,13 +121,18 @@ for DOCKER_MOD in "${DOCKER_MODS[@]}"; do
112121
echo "[mod-init] ${DOCKER_MOD} at ${SHALAYER} has been previously applied skipping"
113122
else
114123
# Download and extract layer to /
115-
curl \
124+
curl -f --retry 10 --retry-max-time 60 --retry-all-errors \
116125
--silent \
117126
--location \
118127
--request GET \
119128
--header "Authorization: Bearer ${TOKEN}" \
120-
"${BLOB_URL}${SHALAYER}" \
121-
| tar xz -C /
129+
"${BLOB_URL}${SHALAYER}" -o \
130+
/modtarball.tar.xz
131+
tar xzf /modtarball.tar.xz -C /
132+
rm -rf /modtarball.tar.xz
122133
echo ${SHALAYER} > "/${FILENAME}"
123134
fi
124135
done
136+
137+
# Set executable bit on cont-init and services that may have been unpacked by mods
138+
set_legacy_executable_bits

root/etc/cont-init.d/01-envfile

100644100755
File mode changed.

root/etc/cont-init.d/10-adduser

100644100755
File mode changed.

root/etc/cont-init.d/90-custom-folders

100644100755
File mode changed.

root/etc/cont-init.d/99-custom-files

100644100755
File mode changed.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ln -s /run/s6/legacy-services /run/s6/services

root/etc/s6-overlay/s6-rc.d/99-ci-service-check/dependencies.d/base

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/99-ci-service-check/dependencies.d/legacy-services

Whitespace-only changes.

root/etc/s6-overlay/s6-rc.d/99-ci-service-check/dependencies.d/user

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
oneshot
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "[ls.io-init] done."

root/etc/s6-overlay/s6-rc.d/user/contents.d/00-legacy

Whitespace-only changes.

root/usr/bin/with-contenv

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#! /bin/bash
2-
if [[ -f /var/run/s6/container_environment/UMASK ]] && [[ "$(pwdx $$)" =~ "/run/s6/services/" ]]; then
3-
umask $(cat /var/run/s6/container_environment/UMASK)
4-
exec /usr/bin/with-contenvb "$@"
5-
else
6-
exec /usr/bin/with-contenvb "$@"
2+
3+
if [[ -f /var/run/s6/container_environment/UMASK ]] && \
4+
{ [[ "$(pwdx $$)" =~ "/run/s6/legacy-services/" ]] || \
5+
[[ "$(pwdx $$)" =~ "/run/s6/services/" ]] || \
6+
[[ "$(pwdx $$)" =~ "/servicedirs/svc-" ]]; }; then
7+
umask $(cat /var/run/s6/container_environment/UMASK)
78
fi
9+
exec /command/with-contenv "$@"

0 commit comments

Comments
 (0)