/librespot-shairport-snapserver

Docker image combining librespot shairport-sync and snapserver

Primary LanguageDockerfile

librespot-shairport-snapserver

Alpine based Docker image for running the snapserver part of snapcast with librespot and shairport-sync as input.

Idea adapted from librespot-snapserver and based on shairport-sync docker image

Background: When this project started, the last releases of snapcast and librespot where outdated compared to their respective develop branches. Therefore, everything is compiled from source using the development branches for all repos.

Note The coresponding Docker image for runinng snapclient can be found here: https://github.com/yubiuser/snapclient-docker

Getting started

Images for amd64 can be found at ghcr.io/yubiuser/librespot-shairport-snapserver.

Use with

docker pull ghcr.io/yubiuser/librespot-shairport-snapserver
docker run -d --rm --net host -v ./snapserver.conf:/etc/snapserver.conf --name snapserver librespot-shairport-snapserver

or with docker-compose.yml

services:
  snapcast:
    image: ghcr.io/yubiuser/librespot-shairport-snapserver
    container_name: snapcast
    restart: unless-stopped
    network_mode: host
    volumes:
     - ./snapserver.conf:/etc/snapserver.conf
     #- /tmp/snapfifo:/tmp/snapfifo

Build locally

To build the image simply run

docker build -t librespot-shairport-snapserver:local -f ./alpine.dockerfile .

Notes

  • Based on Alpine 3:20; final image size is ~116MB
  • All (c)make calles use the option -j $(( $(nproc) -1 )) to leave one CPU for normal operation
  • s6-overlay is used as init system (same as the shairport-sync docker image). This is necessary, because shairport-sync needs a companion application called NQPTP which needs to be started from root to run as deamon.
    • s6-rc with configured dependencies is used to start all services. snapserver should start as last
    • s6-notifyoncheck is used to check readiness of the started services dbus and avahi. The actual check is performed by sending dbusmessages and analyzing the reply.
  • Adjust snapserver.conf as required (Airplay 2 needs port 7000)
  • Snapweb is inclued in the image and can be accessed on http://<snapserver host>:1780
  • An alternative Debian based image (Bookworm) is offered, final image size is ~262 MB