Skip to content

Commit

Permalink
Merge pull request mikebrady#1642 from nipsufn/ci/images-with-pa
Browse files Browse the repository at this point in the history
build docker with pa support - thanks!
  • Loading branch information
mikebrady authored Apr 22, 2023
2 parents fa04892 + 847aff1 commit 5335ac7
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Shairport Sync does not support AirPlay video or photo streaming.

# Quick Start
* A building guide is available [here](BUILD.md).
* A Docker image is available on the [Docker Hub](https://hub.docker.com/r/mikebrady/shairport-sync).
* A Docker image is available on the [Docker Hub](https://hub.docker.com/r/mikebrady/shairport-sync). Also see [docker/README.md](docker/README.md).
* Next Steps and Advanced Topics are [here](ADVANCED%20TOPICS/README.md).
* Runtime settings are documented [here](scripts/shairport-sync.conf).
* Build configuration options are detailed in [CONFIGURATION FLAGS.md](CONFIGURATION%20FLAGS.md).
Expand Down
59 changes: 31 additions & 28 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +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 \
build-base \
dbus \
ffmpeg-dev \
git \
libconfig-dev \
libsndfile-dev \
mosquitto-dev \
libsodium-dev \
libgcrypt-dev \
ffmpeg-dev \
xxd \
libplist-dev \
libressl-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
Expand Down Expand Up @@ -55,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)
Expand All @@ -69,25 +70,26 @@ FROM crazymax/alpine-s6:3.17-3.1.1.2

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 \
libressl3.6-libcrypto \
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
Expand All @@ -100,6 +102,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
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
Expand Down
2 changes: 2 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,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.
Expand Down
40 changes: 21 additions & 19 deletions docker/classic/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -53,20 +54,21 @@ FROM crazymax/alpine-s6:3.17-3.1.1.2

RUN apk -U add \
alsa-lib \
dbus \
popt \
glib \
mbedtls \
soxr \
avahi \
avahi-tools \
dbus \
glib \
less \
less-doc \
libconfig \
mosquitto \
libsndfile-dev \
mandoc \
libpulse \
man-pages \
less \
less-doc
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
Expand Down
6 changes: 5 additions & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions docker/etc/pulse/client.conf
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5335ac7

Please sign in to comment.