Merge pull request #1624 from yubiuser/docker

Update Dockerfiles to Alpine 3.17 and set fixed startup order. Thanks to [yubiuser](https://github.com/yubiuser) for their work on this!
This commit is contained in:
Mike Brady
2023-03-19 09:03:19 +00:00
committed by GitHub
44 changed files with 59 additions and 29 deletions
+9 -5
View File
@@ -1,4 +1,4 @@
FROM alpine:3.12 AS builder
FROM alpine:3.17 AS builder
# Check required arguments exist. These will be provided by the Github Action
# Workflow and are required to ensure the correct branches are being used.
@@ -26,7 +26,6 @@ RUN apk -U add \
ffmpeg-dev \
xxd \
libressl-dev \
openssl-dev \
libplist-dev
##### ALAC #####
@@ -66,7 +65,7 @@ WORKDIR /
##### SPS END #####
# Shairport Sync Runtime System
FROM crazymax/alpine-s6:3.12-3.1.1.2
FROM crazymax/alpine-s6:3.17-3.1.1.2
RUN apk -U add \
alsa-lib \
@@ -83,6 +82,7 @@ RUN apk -U add \
ffmpeg \
libsodium \
libgcrypt \
libressl3.6-libcrypto \
libplist \
mandoc \
man-pages \
@@ -100,7 +100,7 @@ COPY --from=builder /shairport-sync/build/install/etc/dbus-1/system.d/shairport-
COPY --from=builder /shairport-sync/build/install/etc/dbus-1/system.d/shairport-sync-mpris.conf /etc/dbus-1/system.d/
COPY ./docker/etc/s6-overlay/s6-rc.d /etc/s6-overlay/s6-rc.d
RUN chmod +x /etc/s6-overlay/s6-rc.d/startup/script.sh
RUN chmod +x /etc/s6-overlay/s6-rc.d/01-startup/script.sh
# Create non-root user for running the container -- running as the user 'shairport-sync' also allows
# Shairport Sync to provide the D-Bus and MPRIS interfaces within the container
@@ -114,4 +114,8 @@ RUN addgroup -g 29 docker_audio && addgroup shairport-sync docker_audio && addgr
# Remove anything we don't need.
RUN rm -rf /lib/apk/db/*
ENTRYPOINT [ "/init", "/usr/local/bin/shairport-sync" ]
# Add run script that will start SPS
COPY ./docker/run.sh ./run.sh
RUN chmod +x /run.sh
Entrypoint ["/init","./run.sh"]
+1
View File
@@ -32,6 +32,7 @@ $ docker run -d --restart unless-stopped --net host --device /dev/snd \
### Options
Command line options will be passed to Shairport Sync. Here is an example:
```
$ docker run -d --restart unless-stopped --net host --device /dev/snd \
mikebrady/shairport-sync:latest \
+8 -4
View File
@@ -1,4 +1,4 @@
FROM alpine:3.12 AS builder
FROM alpine:3.17 AS builder
# Classic (aka AirPlay 1) Build
@@ -49,7 +49,7 @@ WORKDIR /
##### SPS END #####
# Shairport Sync Runtime System
FROM crazymax/alpine-s6:3.12-3.1.1.2
FROM crazymax/alpine-s6:3.17-3.1.1.2
RUN apk -U add \
alsa-lib \
@@ -78,7 +78,7 @@ COPY --from=builder /shairport-sync/build/install/etc/dbus-1/system.d/shairport-
COPY --from=builder /shairport-sync/build/install/etc/dbus-1/system.d/shairport-sync-mpris.conf /etc/dbus-1/system.d/
COPY ./docker/classic/etc/s6-overlay/s6-rc.d /etc/s6-overlay/s6-rc.d
RUN chmod +x /etc/s6-overlay/s6-rc.d/startup/script.sh
RUN chmod +x /etc/s6-overlay/s6-rc.d/01-startup/script.sh
# Create non-root user for running the container -- running as the user 'shairport-sync' also allows
# Shairport Sync to provide the D-Bus and MPRIS interfaces within the container
@@ -92,4 +92,8 @@ RUN addgroup -g 29 docker_audio && addgroup shairport-sync docker_audio && addgr
# Remove anything we don't need.
RUN rm -rf /lib/apk/db/*
ENTRYPOINT [ "/init", "/usr/local/bin/shairport-sync" ]
# Add run script that will start SPS
COPY ./docker/run.sh ./run.sh
RUN chmod +x /run.sh
Entrypoint ["/init","./run.sh"]
@@ -0,0 +1 @@
base
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/01-startup/script.sh
@@ -1,8 +0,0 @@
#!/command/with-contenv sh
sleep 5
while [ ! -f /var/run/dbus.pid ]; do
"dbus is not running, sleeping for 5 seconds before trying to start avahi"
sleep 5
done
echo "Starting avahi"
exec avahi-daemon --no-chroot
@@ -0,0 +1 @@
01-startup
@@ -1,4 +1,4 @@
#!/command/with-contenv sh
rm -rf /var/run/dbus.pid
rm -rf /var/run/dbus/dbus.pid
echo "Starting dbus"
exec dbus-daemon --system --nofork
@@ -0,0 +1 @@
02-dbus
@@ -0,0 +1,7 @@
#!/command/with-contenv sh
while [ ! -f /var/run/dbus/dbus.pid ]; do
echo "s6-rc: warning: dbus is not running, sleeping for 1 second before trying to start avahi"
sleep 1
done
echo "Starting avahi"
exec avahi-daemon --no-chroot
@@ -1 +0,0 @@
/etc/s6-overlay/s6-rc.d/startup/script.sh
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
while [ ! -f /var/run/avahi-daemon/pid ]; do
echo "Warning: avahi is not running, sleeping for 1 second before trying to start shairport-sync"
sleep 1
done
echo "Starting shairport-sync"
# pass all commandline options to shairport-sync
/usr/local/bin/shairport-sync "$@"
@@ -0,0 +1 @@
base
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/01-startup/script.sh
@@ -1,8 +0,0 @@
#!/command/with-contenv sh
sleep 5
while [ ! -f /var/run/dbus.pid ]; do
"dbus is not running, sleeping for 5 seconds before trying to start avahi"
sleep 5
done
echo "Starting avahi"
exec avahi-daemon --no-chroot
@@ -0,0 +1 @@
01-startup
@@ -1,4 +1,4 @@
#!/command/with-contenv sh
rm -rf /var/run/dbus.pid
rm -rf /var/run/dbus/dbus.pid
echo "Starting dbus"
exec dbus-daemon --system --nofork
@@ -0,0 +1 @@
02-dbus
@@ -0,0 +1,7 @@
#!/command/with-contenv sh
while [ ! -f /var/run/dbus/dbus.pid ]; do
echo "s6-rc: warning: dbus is not running, sleeping for 1 second before trying to start avahi"
sleep 1
done
echo "Starting avahi"
exec avahi-daemon --no-chroot
@@ -0,0 +1 @@
03-avahi
-1
View File
@@ -1 +0,0 @@
/etc/s6-overlay/s6-rc.d/startup/script.sh
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
while [ ! -f /var/run/avahi-daemon/pid ]; do
echo "Warning: avahi is not running, sleeping for 1 second before trying to start shairport-sync"
sleep 1
done
echo "Starting shairport-sync"
# pass all commandline options to shairport-sync
/usr/local/bin/shairport-sync "$@"