merge 4.2 updates from the branch

This commit is contained in:
Mike Brady
2023-05-20 17:48:01 +01:00
90 changed files with 966 additions and 699 deletions
+43 -33
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.
@@ -8,26 +8,26 @@ ARG NQPTP_BRANCH
RUN test -n "$NQPTP_BRANCH"
RUN apk -U add \
git \
build-base \
alsa-lib-dev \
autoconf \
automake \
libtool \
dbus \
alsa-lib-dev \
popt-dev \
soxr-dev \
avahi-dev \
libconfig-dev \
libsndfile-dev \
mosquitto-dev \
libsodium-dev \
libgcrypt-dev \
build-base \
dbus \
ffmpeg-dev \
xxd \
git \
libconfig-dev \
libgcrypt-dev \
libplist-dev \
libressl-dev \
openssl-dev \
libplist-dev
libsndfile-dev \
libsodium-dev \
libtool \
mosquitto-dev \
popt-dev \
pulseaudio-dev \
soxr-dev \
xxd
##### ALAC #####
RUN git clone https://github.com/mikebrady/alac
@@ -56,8 +56,8 @@ COPY . .
RUN git checkout "$SHAIRPORT_SYNC_BRANCH"
WORKDIR /shairport-sync/build
RUN autoreconf -i ../
RUN ../configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-airplay-2 \
--with-metadata --with-dummy --with-pipe --with-dbus-interface \
RUN ../configure --sysconfdir=/etc --with-alsa --with-pa --with-soxr --with-avahi --with-ssl=openssl \
--with-airplay-2 --with-metadata --with-dummy --with-pipe --with-dbus-interface \
--with-stdout --with-mpris-interface --with-mqtt-client \
--with-apple-alac --with-convolution
RUN make -j $(nproc)
@@ -66,28 +66,33 @@ 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
ENV S6_CMD_WAIT_FOR_SERVICES=1
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
RUN apk -U add \
alsa-lib \
dbus \
popt \
glib \
soxr \
avahi \
avahi-tools \
libconfig \
libsndfile \
mosquitto \
libuuid \
dbus \
ffmpeg \
libsodium \
glib \
less \
less-doc \
libconfig \
libgcrypt \
libplist \
mandoc \
libpulse \
libressl3.6-libcrypto \
libsndfile \
libsodium \
libuuid \
man-pages \
less \
less-doc
mandoc \
mosquitto \
popt \
soxr
# Copy build files.
COPY --from=builder /shairport-sync/build/install/usr/local/bin/shairport-sync /usr/local/bin/shairport-sync
@@ -100,7 +105,8 @@ 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
COPY ./docker/etc/pulse /etc/pulse
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 +120,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"]
+3
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 \
@@ -39,6 +40,8 @@ $ docker run -d --restart unless-stopped --net host --device /dev/snd \
```
This will send audio to alsa hardware device `hw:0` and make use of the that device's mixer control called `PCM`. The service will be visible as `DenSystem` on the network.
The image is built with PulseAudio backend support. To use it, refer to [`docker-compose.yaml`](docker-compose.yaml) for required environment variables and mounts. You might need to adjust authentication on your PulseAudio server ([PA documentation](https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-native-protocol-unixtcp)) and set default backend to `pa` via either command line option `-o` or `general.output_backend` field in config file.
## Configuration File
To get access to the full range of configuration options, pass the configuration file to `/etc/shairport-sync.conf` in the container using the `-v` option or docker compose.
+34 -25
View File
@@ -1,4 +1,4 @@
FROM alpine:3.12 AS builder
FROM alpine:3.17 AS builder
# Classic (aka AirPlay 1) Build
@@ -8,20 +8,21 @@ ARG SHAIRPORT_SYNC_BRANCH
RUN test -n "$SHAIRPORT_SYNC_BRANCH"
RUN apk -U add \
git \
build-base \
alsa-lib-dev \
autoconf \
automake \
libtool \
dbus \
alsa-lib-dev \
popt-dev \
mbedtls-dev \
soxr-dev \
avahi-dev \
build-base \
dbus \
git \
libconfig-dev \
libsndfile-dev \
libtool \
mbedtls-dev \
mosquitto-dev \
libsndfile-dev
popt-dev \
pulseaudio-dev \
soxr-dev
##### ALAC #####
RUN git clone https://github.com/mikebrady/alac
@@ -39,7 +40,7 @@ COPY . .
RUN git checkout "$SHAIRPORT_SYNC_BRANCH"
WORKDIR /shairport-sync/build
RUN autoreconf -i ../
RUN ../configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=mbedtls \
RUN ../configure --sysconfdir=/etc --with-alsa --with-pa --with-soxr --with-avahi --with-ssl=mbedtls \
--with-metadata --with-dummy --with-pipe --with-dbus-interface \
--with-stdout --with-mpris-interface --with-mqtt-client \
--with-apple-alac --with-convolution
@@ -49,24 +50,28 @@ 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
ENV S6_CMD_WAIT_FOR_SERVICES=1
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
RUN apk -U add \
alsa-lib \
dbus \
popt \
glib \
mbedtls \
soxr \
avahi \
avahi-tools \
libconfig \
mosquitto \
libsndfile-dev \
mandoc \
man-pages \
dbus \
glib \
less \
less-doc
less-doc \
libconfig \
libsndfile-dev \
libpulse \
man-pages \
mandoc \
mbedtls \
mosquitto \
popt \
soxr
# Copy build files.
COPY --from=builder /shairport-sync/build/install/usr/local/bin/shairport-sync /usr/local/bin/shairport-sync
@@ -78,7 +83,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 +97,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,4 +0,0 @@
#!/command/with-contenv sh
rm -rf /var/run/dbus.pid
echo "Starting dbus"
exec dbus-daemon --system --nofork
@@ -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
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null
@@ -0,0 +1 @@
01-startup
@@ -0,0 +1 @@
3
@@ -0,0 +1,3 @@
#!/command/with-contenv sh
echo "Starting dbus"
exec s6-notifyoncheck dbus-daemon --system --nofork --nopidfile
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
state="$(dbus-send --system --dest=org.freedesktop.Avahi --print-reply / org.freedesktop.Avahi.Server.GetState | grep int32 | awk '{printf $2}')"
# Avahi will return 'state=2' when 'Server startup complete'
if [ "$state" = 2 ]; then
exit 0
else
exit 1
fi
@@ -0,0 +1 @@
02-dbus
@@ -0,0 +1 @@
3
@@ -0,0 +1,3 @@
#!/command/with-contenv sh
echo "Starting avahi"
exec s6-notifyoncheck 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 "$@"
+5 -1
View File
@@ -5,10 +5,14 @@ services:
image: mikebrady/shairport-sync:latest
network_mode: host
restart: unless-stopped
# environment:
# PULSE_SERVER: unix:/tmp/pulseaudio.socket # Path for PulseAudio socket
# PULSE_COOKIE: /tmp/pulseaudio.cookie # Path for PulseAudio cookie
devices:
- "/dev/snd"
- "/dev/snd" # ALSA device
# volumes:
# - ./volumes/shairport-sync/shairport-sync.conf:/etc/shairport-sync.conf # Customised Shairport Sync configuration file.
# - /run/user/1000/pulse/native:/tmp/pulseaudio.socket # PulseAudio socket when using that backend
logging:
options:
max-size: "200k"
+6
View File
@@ -0,0 +1,6 @@
default-server = unix:/tmp/pulseaudio.socket
# Prevent a server running in the container
autospawn = no
daemon-binary = /bin/true
# Prevent the use of shared memory
enable-shm = false
@@ -1,4 +0,0 @@
#!/command/with-contenv sh
rm -rf /var/run/dbus.pid
echo "Starting dbus"
exec dbus-daemon --system --nofork
@@ -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
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec dbus-send --system / org.freedesktop.DBus.Peer.Ping > /dev/null 2> /dev/null
@@ -0,0 +1 @@
01-startup
@@ -0,0 +1 @@
3
@@ -0,0 +1,3 @@
#!/command/with-contenv sh
echo "Starting dbus"
exec s6-notifyoncheck dbus-daemon --system --nofork --nopidfile
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
state="$(dbus-send --system --dest=org.freedesktop.Avahi --print-reply / org.freedesktop.Avahi.Server.GetState | grep int32 | awk '{printf $2}')"
# Avahi will return 'state=2' when 'Server startup complete'
if [ "$state" = 2 ]; then
exit 0
else
exit 1
fi
@@ -0,0 +1 @@
02-dbus
@@ -0,0 +1 @@
3
@@ -0,0 +1,3 @@
#!/command/with-contenv sh
echo "Starting avahi"
exec s6-notifyoncheck avahi-daemon --no-chroot
@@ -0,0 +1 @@
01-startup
-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 "$@"