Merge remote-tracking branch 'origin/development'

This commit is contained in:
Mike Brady
2022-09-15 17:28:47 +01:00
112 changed files with 23640 additions and 4301 deletions
+116
View File
@@ -0,0 +1,116 @@
FROM alpine:3.12 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.
ARG SHAIRPORT_SYNC_BRANCH
RUN test -n "$SHAIRPORT_SYNC_BRANCH"
ARG NQPTP_BRANCH
RUN test -n "$NQPTP_BRANCH"
RUN apk -U add \
git \
build-base \
autoconf \
automake \
libtool \
dbus \
alsa-lib-dev \
popt-dev \
mbedtls-dev \
soxr-dev \
avahi-dev \
libconfig-dev \
libsndfile-dev \
mosquitto-dev \
xmltoman \
openssh-client \
libsodium-dev \
ffmpeg-dev \
xxd \
libressl-dev \
openssl-dev \
libplist-dev \
libgcrypt-dev
##### ALAC #####
RUN git clone https://github.com/mikebrady/alac
WORKDIR /alac
RUN autoreconf -i
RUN ./configure
RUN make
RUN make install
WORKDIR /
##### ALAC END #####
##### NQPTP #####
RUN git clone https://github.com/mikebrady/nqptp
WORKDIR /nqptp
RUN git checkout "$NQPTP_BRANCH"
RUN autoreconf -i
RUN ./configure
RUN make
RUN make install
WORKDIR /
##### NQPTP END #####
##### SPS #####
WORKDIR /shairport-sync
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 \
--with-stdout --with-mpris-interface --with-mqtt-client \
--with-apple-alac --with-convolution
RUN make -j $(nproc)
RUN DESTDIR=install make install
WORKDIR /
##### SPS END #####
# Shairport Sync Runtime System
FROM crazymax/alpine-s6:3.12-3.1.1.2
RUN apk -U add \
alsa-lib \
dbus \
popt \
glib \
mbedtls \
soxr \
avahi \
avahi-tools \
libconfig \
libsndfile \
mosquitto \
libuuid \
ffmpeg \
libsodium \
libplist \
libgcrypt
# Copy build files.
COPY --from=builder /shairport-sync/build/install/usr/local/bin/shairport-sync /usr/local/bin/shairport-sync
COPY --from=builder /usr/local/bin/nqptp /usr/local/bin/nqptp
COPY --from=builder /usr/local/lib/libalac.* /usr/local/lib/
COPY --from=builder /shairport-sync/build/install/etc/dbus-1/system.d/shairport-sync-dbus.conf /etc/dbus-1/system.d/
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
# 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
RUN addgroup shairport-sync
RUN adduser -D shairport-sync -G shairport-sync
# Add the shairport-sync user to the pre-existing audio group, which has ID 29, for access to the ALSA stuff
RUN addgroup -g 29 docker_audio && addgroup shairport-sync docker_audio && addgroup shairport-sync audio
# Remove anything we don't need.
RUN rm -rf /lib/apk/db/*
ENTRYPOINT [ "/init" ]
CMD [ "/usr/local/bin/shairport-sync", "-v", "--statistics" ]
+47 -4
View File
@@ -2,12 +2,55 @@
Available at: https://hub.docker.com/r/mikebrady/shairport-sync
## Original AirPlay 1 Image
Please see: [airplay1/README.md](airplay1/README.md)
Please note if you want the development version of the image including Airplay 2 support, please pull the image with the ```unstable development``` tag using the following command:
```
docker pull mikebrady/shairport-sync:unstable-development
```
When using the below commands, you should replace mikebrady/shairport-sync with mikbrady/shairport-sync:unstable-development.
## Example Docker Compose File
See the `docker-compose.yaml` file in this folder for an example.
## Docker Run
```
$ docker run -d --restart unless-stopped --net host --device /dev/snd \
mikebrady/shairport-sync
```
### Options
You can change the default commands passed to Shairport Sync. Here is an example:
```
$ docker run -d --restart unless-stopped --net host --device /dev/snd \
mikebrady/shairport-sync:unstable-development shairport-sync -v \
--statistics -a DenSystem -d hw:0 -c PCM
```
This will sent 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.
## 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.
## Building
### Build Example (for arm7 devices)
```
docker buildx build --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg SHAIRPORT_SYNC_BRANCH=development --build-arg NQPTP_BRANCH=development --no-cache -t shairport-sync:unstable-development .
```
`SHAIRPORT_SYNC_BRANCH` and `NQPTP_BRANCH` are required to ensure the image is built using the expected branch.
`--no-cache` needs to be used to force buildx to pull the NQPTP branch for new updates. This slows down the build time though so can be removed when it is not beneficial during testing.
### AirPlay 1 Only
The AirPlay 1 only dockerfile is in the `classic` folder. This also includes the `start.sh` script used by the container. Please note that the AirPlay 1 image built via the AirPlay 2 branch has missing functionality, e.g. it does not work with multiple instances on the same hardware; does not support iTunes for Windows etc.
### GitHub Action Builds
## GitHub Action Builds
Requires the following secrets to be set in the repo:
- `DOCKER_REGISTRY` - docker.io if using Docker Hub, else set to your registry URL.
- `DOCKER_REGISTRY_TOKEN` - Access token for your registry.
- `DOCKER_REGISTRY_USER` - Login user for your registry.
- `DOCKER_IMAGE_NAME` - The name of the image, for example `your-registry.com/shairport-sync` or just `your-username/shairport-sync` if using Docker Hub.
- `DOCKER_IMAGE_NAME` - The name of the image, for example `your-registry.com/shairport-sync` or just `your-username/shairport-sync` if using Docker Hub.
+104
View File
@@ -0,0 +1,104 @@
FROM alpine AS builder-base
# General Build System:
RUN apk -U add \
git \
build-base \
autoconf \
automake \
libtool \
dbus \
su-exec \
alsa-lib-dev \
libdaemon-dev \
popt-dev \
mbedtls-dev \
soxr-dev \
avahi-dev \
libconfig-dev \
libsndfile-dev \
mosquitto-dev \
xmltoman
# ALAC Build System:
FROM builder-base AS builder-alac
RUN git clone https://github.com/mikebrady/alac
WORKDIR alac
RUN autoreconf -fi
RUN ./configure
RUN make
RUN make install
# Shairport Sync Build System:
FROM builder-base AS builder-sps
# This will be modified by the Github Action Workflow and is required
# to ensure the correct branch is being used.
ARG SHAIRPORT_SYNC_BRANCH
RUN test -n "$SHAIRPORT_SYNC_BRANCH"
COPY --from=builder-alac /usr/local/lib/libalac.* /usr/local/lib/
COPY --from=builder-alac /usr/local/lib/pkgconfig/alac.pc /usr/local/lib/pkgconfig/alac.pc
COPY --from=builder-alac /usr/local/include /usr/local/include
WORKDIR /shairport-sync
COPY . .
RUN git checkout "$SHAIRPORT_SYNC_BRANCH"
RUN autoreconf -fi
RUN ./configure \
--with-alsa \
--with-dummy \
--with-pipe \
--with-stdout \
--with-avahi \
--with-ssl=mbedtls \
--with-soxr \
--sysconfdir=/etc \
--with-dbus-interface \
--with-mpris-interface \
--with-mqtt-client \
--with-apple-alac \
--with-convolution
RUN make -j $(nproc)
RUN make install
# Shairport Sync Runtime System:
FROM alpine
RUN apk -U add \
alsa-lib \
dbus \
popt \
glib \
mbedtls \
soxr \
avahi \
avahi-tools \
libconfig \
libsndfile \
mosquitto-libs \
su-exec \
libgcc \
libgc++
RUN rm -rf /lib/apk/db/*
COPY --from=builder-alac /usr/local/lib/libalac.* /usr/local/lib/
COPY --from=builder-sps /etc/shairport-sync* /etc/
COPY --from=builder-sps /etc/dbus-1/system.d/shairport-sync-dbus.conf /etc/dbus-1/system.d/
COPY --from=builder-sps /etc/dbus-1/system.d/shairport-sync-mpris.conf /etc/dbus-1/system.d/
COPY --from=builder-sps /usr/local/bin/shairport-sync /usr/local/bin/shairport-sync
# 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
RUN addgroup shairport-sync
RUN adduser -D shairport-sync -G shairport-sync
# Add the shairport-sync user to the pre-existing audio group, which has ID 29, for access to the ALSA stuff
RUN addgroup -g 29 docker_audio && addgroup shairport-sync docker_audio
COPY ./docker/classic/start.sh /
RUN chmod +x /start.sh
ENTRYPOINT [ "/start.sh" ]
+3
View File
@@ -0,0 +1,3 @@
# Classic (AirPlay 1 Only) Docker Image
See the [Shairport Sync Docker Hub Repo](https://hub.docker.com/r/mikebrady/shairport-sync) for available tags.
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
set -e
rm -rf /var/run/dbus.pid
#mkdir -p /var/run/dbus
dbus-uuidgen --ensure
dbus-daemon --system
avahi-daemon --daemonize --no-chroot
su-exec shairport-sync shairport-sync "$@"
@@ -0,0 +1,2 @@
#!/command/execlineb -S0
/run/s6/basedir/bin/halt
@@ -0,0 +1,4 @@
#!/command/with-contenv sh
rm -rf /var/run/dbus.pid
echo "Starting dbus"
exec dbus-daemon --system --nofork
@@ -0,0 +1 @@
longrun
@@ -0,0 +1,2 @@
#!/command/execlineb -S0
/run/s6/basedir/bin/halt
@@ -0,0 +1,8 @@
#!/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 @@
longrun
@@ -0,0 +1,2 @@
#!/command/execlineb -S0
/run/s6/basedir/bin/halt
@@ -0,0 +1,3 @@
#!/command/with-contenv sh
echo "Starting nqptp"
exec /usr/local/bin/nqptp -v
@@ -0,0 +1 @@
longrun
@@ -0,0 +1,2 @@
#!/bin/sh
echo "STARTING - $(date)"
@@ -0,0 +1 @@
oneshot
+1
View File
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/startup/script.sh