Merge pull request #2 from charlesomer/development

Current Docker Image Progress
This commit is contained in:
Mike Brady
2021-05-06 20:07:39 +01:00
committed by GitHub
6 changed files with 226 additions and 0 deletions
@@ -0,0 +1,42 @@
# Pushes to tag 'unstable-BRANCH'.
# Releases are pushed to latest and tagged - see docker-build-releases.yaml.
name: Build and push docker image based on master branch.
on:
push:
branches: [ master, development ]
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set branch env.
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set up ssh agent
uses: webfactory/ssh-agent@v0.5.2 # Can be removed when no longer pulling from private repos.
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: registry.nova.do
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: ./
file: ./docker/Dockerfile
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7
push: true
tags: registry.nova.do/shairport-sync:unstable-${{ env.BRANCH }}
build-args: |
BRANCH=${{ env.BRANCH }}
ssh: github=${{ env.SSH_AUTH_SOCK }} # Can be removed when no longer pulling from private repos.
+137
View File
@@ -0,0 +1,137 @@
FROM alpine:3.12 AS builder-base
# Version 3.12 is required for now since libplist has breaking changes in v3.13 and above which are not yet standard
# in debian/ubuntu.
# 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 \
openssh-client \
libsodium-dev \
ffmpeg-dev \
xxd \
libressl-dev \
openssl-dev \
libplist-dev
# 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 may be modified by the Github Action Workflow.
ARG SHAIRPORT_SYNC_BRANCH=development
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
# TODO: Remove when no longer pulling from private repos.
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh,id=github git clone git@github.com:charlesomer/nqptp.git
WORKDIR /nqptp
# Use development branch for now.
RUN git checkout development
RUN autoreconf -fi
RUN ./configure
RUN make
RUN make install
WORKDIR /
RUN --mount=type=ssh,id=github git clone git@github.com:aillwee/shairport-sync.git
WORKDIR /shairport-sync
RUN git checkout "$SHAIRPORT_SYNC_BRANCH"
RUN autoreconf -fi
RUN git submodule init
RUN git submodule update
# 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 \
# --with-airplay-2
# RUN make -j $(nproc)
RUN CFLAGS="-O0 -g" CXXFLAGS="-O0 -g" ./configure --sysconfdir=/etc --with-metadata --with-dummy --with-pipe \
--with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-dbus-interface --with-stdout \
--with-mpris-interface --with-mqtt-client --with-apple-alac --with-convolution --with-airplay-2
RUN make -j
RUN make install
# Shairport Sync Runtime System:
FROM alpine:3.12
RUN apk add \
alsa-lib \
dbus \
popt \
glib \
mbedtls \
soxr \
avahi \
libconfig \
libsndfile \
mosquitto-libs \
su-exec \
libuuid \
ffmpeg-dev \
ffmpeg-libs \
libsodium-dev \
libplist-dev
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
COPY --from=builder-sps /usr/local/bin/nqptp /usr/local/bin/nqptp
# 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
COPY ./docker/shairport-sync.conf /etc/shairport-sync.conf
COPY ./docker/start.sh /
RUN chmod +x ./start.sh
ENTRYPOINT [ "/start.sh" ]
+3
View File
@@ -0,0 +1,3 @@
# Shairport Sync Docker Image
https://hub.docker.com/r/mikebrady/shairport-sync
+12
View File
@@ -0,0 +1,12 @@
# Example docker compose config.
version: "3.8"
services:
shairport-sync:
image: registry.nova.do/shairport-sync:unstable-development
network_mode: host
restart: unless-stopped
devices:
- "/dev/snd"
volumes:
- ./volumes/shairport-sync/shairport-sync.conf:/etc/shairport-sync.conf
+14
View File
@@ -0,0 +1,14 @@
# Temp sample Configuration File for Shairport Sync on a Raspberry Pi using the built-in audio DAC.
general =
{
volume_range_db = 60;
};
alsa =
{
output_device = "hw:0";
# Could also be hw:1. aplay -l should help identify the correct one.
# e.g. card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
# card x where x is the number to use above in hw:x
mixer_control_name = "Headphone";
};
+18
View File
@@ -0,0 +1,18 @@
#!/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
# TODO: This should probably be implemented in a better way and using the correct nqptp group.
nqptp &
# su-exec shairport-sync shairport-sync $@
shairport-sync -vu --statistics