diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84d14fe..18db331 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - repository: [restic-auto, telegraf, piwigo-souvenirs, docker2mqtt] + repository: [restic-auto, telegraf, piwigo-souvenirs, docker2mqtt, shairport-sync, snapserver] steps: - name: Checkout diff --git a/shairport-sync/Dockerfile b/shairport-sync/Dockerfile new file mode 100644 index 0000000..742b3f3 --- /dev/null +++ b/shairport-sync/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:latest AS builder + +RUN apk update \ + && apk add git build-base autoconf automake libtool alsa-lib-dev libdaemon-dev popt-dev libressl-dev soxr-dev avahi-dev libconfig-dev curl asio-dev flac-dev libvorbis-dev mosquitto-dev \ + && mkdir /root/shairport-sync \ + && cd /root/shairport-sync \ + && while [ "$DOWNLOAD_URL" == "" ] ; do DOWNLOAD_URL=$(curl -s https://api.github.com/repos/mikebrady/shairport-sync/releases/latest | grep "tarball_url" | cut -d\" -f4) ; done \ + && curl --retry 3 -L -s -o /tmp/shairport-sync.tar.gz $DOWNLOAD_URL \ + && tar xzf /tmp/shairport-sync.tar.gz --strip-components=1 \ + && autoreconf -i -f \ + && ./configure --with-pipe --with-avahi --with-soxr --with-metadata --with-mqtt-client --with-ssl=openssl \ + && make + +RUN cd /root/shairport-sync \ + && make install + +FROM alpine:latest + +RUN apk add --no-cache avahi-libs dbus libdaemon popt libressl soxr avahi libconfig mosquitto-libs su-exec \ + && addgroup shairport-sync \ + && adduser -D shairport-sync -G shairport-sync + +COPY --from=builder /root/shairport-sync/shairport-sync /usr/local/bin/ +COPY --from=builder /usr/local/etc/shairport-sync.conf /etc/shairport-sync.conf +COPY start.sh /usr/local/bin + +ENTRYPOINT [ "/usr/local/bin/start.sh" ] +CMD [ "-c", "/etc/shairport-sync.conf", "-u" ] diff --git a/shairport-sync/start.sh b/shairport-sync/start.sh new file mode 100755 index 0000000..ba0bd49 --- /dev/null +++ b/shairport-sync/start.sh @@ -0,0 +1,8 @@ +#!/bin/sh +rm -rf /var/run +mkdir -p /var/run/dbus +dbus-uuidgen --ensure +dbus-daemon --system +avahi-daemon --daemonize --no-chroot +su-exec shairport-sync /usr/local/bin/shairport-sync $@ + diff --git a/snapserver/Dockerfile b/snapserver/Dockerfile new file mode 100644 index 0000000..47e2450 --- /dev/null +++ b/snapserver/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:latest + +RUN apk add --no-cache snapcast-server su-exec + +COPY start.sh /usr/local/bin + +ENTRYPOINT [ "/usr/local/bin/start.sh" ] diff --git a/snapserver/start.sh b/snapserver/start.sh new file mode 100755 index 0000000..a8489ed --- /dev/null +++ b/snapserver/start.sh @@ -0,0 +1,2 @@ +#!/bin/sh +su-exec snapcast /usr/bin/snapserver $@