From 25de2bd3cefbd1273ca72121d8b69af9675bcf17 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:29:58 +0100 Subject: [PATCH 01/22] Added docker. --- .github/workflows/docker-build-releases.yaml | 64 +++++++++ .github/workflows/docker-build.yaml | 62 +++++++++ docker/Dockerfile | 137 +++++++++++++++++++ docker/README.md | 39 ++++++ docker/airplay1/Dockerfile | 103 ++++++++++++++ docker/airplay1/README.md | 3 + docker/airplay1/start.sh | 13 ++ docker/docker-compose.yaml | 11 ++ docker/start.sh | 18 +++ 9 files changed, 450 insertions(+) create mode 100644 .github/workflows/docker-build-releases.yaml create mode 100644 .github/workflows/docker-build.yaml create mode 100644 docker/Dockerfile create mode 100644 docker/README.md create mode 100644 docker/airplay1/Dockerfile create mode 100644 docker/airplay1/README.md create mode 100644 docker/airplay1/start.sh create mode 100644 docker/docker-compose.yaml create mode 100644 docker/start.sh diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml new file mode 100644 index 00000000..745d4ffd --- /dev/null +++ b/.github/workflows/docker-build-releases.yaml @@ -0,0 +1,64 @@ +# Builds & pushes a docker image when a release occurs. + +# The following tags are created: +# 'latest' & 'latest-airplay1' +# '[RELEASE TAG]' & '[RELEASE TAG]-airplay1' + +name: Build and push docker images on releases. + +on: + release: + types: [ published ] + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set SHAIRPORT_SYNC_BRANCH env. + run: echo "SHAIRPORT_SYNC_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: ${{ env.DOCKER_REGISTRY }} + 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: ${{ env.DOCKER_REGISTRY }}/shairport-sync:latest ${{ env.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }} + build-args: | + SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} + ssh: default=${{ env.SSH_AUTH_SOCK }} # Can be removed when no longer pulling from private repos. + + - name: Build and push (AirPlay 1) + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./docker/airplay1/Dockerfile-AirPlay1 + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 + push: true + tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:latest-airplay1, ${{ env.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }}-airplay1 + build-args: | + SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 00000000..3a3d8392 --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,62 @@ +# Builds & pushes a docker image when a commit is made to one of the branches specified below. +# Tag pattern: 'unstable-[BRANCH NAME]'. +# See docker-build-releases.yaml for release build process. + +name: Build and push docker image based on commit to specified branches. + +on: + push: + branches: [ master, development, charles-dev ] + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set SHAIRPORT_SYNC_BRANCH env. + run: echo "SHAIRPORT_SYNC_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: ${{ env.DOCKER_REGISTRY }} + 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: ${{ env.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} + build-args: | + SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} + ssh: default=${{ env.SSH_AUTH_SOCK }} # Can be removed when no longer pulling from private repos. + + - name: Build and push (AirPlay 1) + uses: docker/build-push-action@v2 + with: + context: ./ + file: ./docker/airplay1/Dockerfile + platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 + push: true + tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}-airplay1 + build-args: | + SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..1203b1c6 --- /dev/null +++ b/docker/Dockerfile @@ -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 \ + libgcrypt-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 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 + +# 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 git clone git@github.com:mikebrady/nqptp.git +WORKDIR /nqptp +# Use development branch for now. +RUN git checkout development +RUN autoreconf -fi +RUN ./configure +RUN make +RUN make install +WORKDIR / + +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 \ +# --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 -U add \ + alsa-lib \ + dbus \ + popt \ + glib \ + mbedtls \ + soxr \ + avahi \ + libconfig \ + libsndfile \ + mosquitto \ + su-exec \ + libuuid \ + ffmpeg \ + libsodium \ + libplist \ + libgcrypt + +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/start.sh / + +RUN chmod +x ./start.sh + +ENTRYPOINT [ "/start.sh" ] \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000..fa2b1b53 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,39 @@ +# Shairport Sync Docker Image + +Available at: https://hub.docker.com/r/mikebrady/shairport-sync + +## Example Docker Compose File +See the `docker-compose.yaml` file in this folder for an example. + +## Basic Usage + +``` +$ docker run -d --restart unless-stopped --net host --device /dev/snd \ + mikebrady/shairport-sync +``` +The above command will run Shairport Sync as a daemon in a Docker container, accessing the computer's ALSA audio infrastructure. It will send audio to the default output device and make no use of any hardware mixers the default device might have. The AirPlay service name will be the host's `hostname` with the first letter capitalised, e.g. `Ubuntu`. + +## Options + +Any options you add to the command above will be passed to Shairport Sync. Here is an example: +``` +$ docker run -d --restart unless-stopped --net host --device /dev/snd \ + mikebrady/shairport-sync -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 + +Edit the configuration file `/etc/shairport-sync.conf` in the container (or use the `-v` option to mirror an external copy of `shairport-sync.conf` in to `/etc/shairport-sync.conf`) to get access to the full range of configuration options. + +## Build Example (for arm7 devices) + +TODO: remove `--ssh` when going public as this is only for private repos. +``` +docker buildx build --ssh default=$SSH_AUTH_SOCK --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg SHAIRPORT_SYNC_BRANCH=development -t shairport-sync:unstable-development . +``` + +`SHAIRPORT_SYNC_BRANCH` is required to ensure the image is built using the expected branch. + +## AirPlay 1 Only +The AirPlay1 only dockerfile is in the `airplay1` folder. This also includes the `start.sh` script used by the container. \ No newline at end of file diff --git a/docker/airplay1/Dockerfile b/docker/airplay1/Dockerfile new file mode 100644 index 00000000..e60fd0b5 --- /dev/null +++ b/docker/airplay1/Dockerfile @@ -0,0 +1,103 @@ +FROM alpine:3.12 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:3.12 + +RUN apk -U add \ + alsa-lib \ + dbus \ + popt \ + glib \ + mbedtls \ + soxr \ + avahi \ + 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/airplay1/start.sh / +RUN chmod +x /start.sh + +ENTRYPOINT [ "/start.sh" ] diff --git a/docker/airplay1/README.md b/docker/airplay1/README.md new file mode 100644 index 00000000..247754e6 --- /dev/null +++ b/docker/airplay1/README.md @@ -0,0 +1,3 @@ +# AirPlay 1 Only Docker Image + +See the [Shairport Sync Docker Hub Repo](https://hub.docker.com/r/mikebrady/shairport-sync) for available tags. For the latest build, use `latest-airplay1`. \ No newline at end of file diff --git a/docker/airplay1/start.sh b/docker/airplay1/start.sh new file mode 100644 index 00000000..f68a122f --- /dev/null +++ b/docker/airplay1/start.sh @@ -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 $@ \ No newline at end of file diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml new file mode 100644 index 00000000..74ed09ac --- /dev/null +++ b/docker/docker-compose.yaml @@ -0,0 +1,11 @@ +# Example docker compose config. + +services: + shairport-sync: + image: mikebrady/shairport-sync:unstable-development + network_mode: host + restart: unless-stopped + devices: + - "/dev/snd" + # volumes: + # - ./volumes/shairport-sync/shairport-sync.conf:/etc/shairport-sync.conf # Customised Shairport Sync configuration file. \ No newline at end of file diff --git a/docker/start.sh b/docker/start.sh new file mode 100644 index 00000000..bb790283 --- /dev/null +++ b/docker/start.sh @@ -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 \ No newline at end of file From bb26b1bc8d228d72bd8d65bcb2bebc5da557c6ae Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:32:30 +0100 Subject: [PATCH 02/22] Remove ssh key stuff. --- .github/workflows/docker-build-releases.yaml | 8 +------- .github/workflows/docker-build.yaml | 8 +------- docker/Dockerfile | 5 +---- docker/README.md | 3 +-- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 745d4ffd..437c87e3 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -8,7 +8,7 @@ name: Build and push docker images on releases. on: release: - types: [ published ] + types: [ ] jobs: main: @@ -22,11 +22,6 @@ jobs: - name: Set SHAIRPORT_SYNC_BRANCH env. run: echo "SHAIRPORT_SYNC_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 @@ -50,7 +45,6 @@ jobs: tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:latest ${{ env.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} - ssh: default=${{ env.SSH_AUTH_SOCK }} # Can be removed when no longer pulling from private repos. - name: Build and push (AirPlay 1) uses: docker/build-push-action@v2 diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 3a3d8392..d3eab23d 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -6,7 +6,7 @@ name: Build and push docker image based on commit to specified branches. on: push: - branches: [ master, development, charles-dev ] + branches: [ development ] jobs: main: @@ -20,11 +20,6 @@ jobs: - name: Set SHAIRPORT_SYNC_BRANCH env. run: echo "SHAIRPORT_SYNC_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 @@ -48,7 +43,6 @@ jobs: tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} - ssh: default=${{ env.SSH_AUTH_SOCK }} # Can be removed when no longer pulling from private repos. - name: Build and push (AirPlay 1) uses: docker/build-push-action@v2 diff --git a/docker/Dockerfile b/docker/Dockerfile index 1203b1c6..210d4868 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -52,10 +52,7 @@ 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 git clone git@github.com:mikebrady/nqptp.git +RUN git clone git@github.com:mikebrady/nqptp.git WORKDIR /nqptp # Use development branch for now. RUN git checkout development diff --git a/docker/README.md b/docker/README.md index fa2b1b53..87c26f99 100644 --- a/docker/README.md +++ b/docker/README.md @@ -28,9 +28,8 @@ Edit the configuration file `/etc/shairport-sync.conf` in the container (or use ## Build Example (for arm7 devices) -TODO: remove `--ssh` when going public as this is only for private repos. ``` -docker buildx build --ssh default=$SSH_AUTH_SOCK --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg SHAIRPORT_SYNC_BRANCH=development -t shairport-sync:unstable-development . +docker buildx build --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg SHAIRPORT_SYNC_BRANCH=development -t shairport-sync:unstable-development . ``` `SHAIRPORT_SYNC_BRANCH` is required to ensure the image is built using the expected branch. From 95a9f68bc82a4a9782993b62fdb23854e5bc803b Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:37:02 +0100 Subject: [PATCH 03/22] Update docs. --- docker/airplay1/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/airplay1/README.md b/docker/airplay1/README.md index 247754e6..1d68a959 100644 --- a/docker/airplay1/README.md +++ b/docker/airplay1/README.md @@ -1,3 +1,3 @@ # AirPlay 1 Only Docker Image -See the [Shairport Sync Docker Hub Repo](https://hub.docker.com/r/mikebrady/shairport-sync) for available tags. For the latest build, use `latest-airplay1`. \ No newline at end of file +See the [Shairport Sync Docker Hub Repo](https://hub.docker.com/r/mikebrady/shairport-sync) for available tags. \ No newline at end of file From 49a292759d2f9e95b4e358efe2a8daac4e0d42ce Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:39:40 +0100 Subject: [PATCH 04/22] Update docker registry location. --- .github/workflows/docker-build-releases.yaml | 6 +++--- .github/workflows/docker-build.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 437c87e3..a9da88e4 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -31,7 +31,7 @@ jobs: - name: Login to Docker Registry uses: docker/login-action@v1 with: - registry: ${{ env.DOCKER_REGISTRY }} + registry: ${{ secrets.DOCKER_REGISTRY }} username: ${{ secrets.DOCKER_REGISTRY_USER }} password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} @@ -42,7 +42,7 @@ jobs: file: ./docker/Dockerfile platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:latest ${{ env.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }} + tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:latest ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} @@ -53,6 +53,6 @@ jobs: file: ./docker/airplay1/Dockerfile-AirPlay1 platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:latest-airplay1, ${{ env.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }}-airplay1 + tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:latest-airplay1, ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }}-airplay1 build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index d3eab23d..fe14f93c 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -29,7 +29,7 @@ jobs: - name: Login to Docker Registry uses: docker/login-action@v1 with: - registry: ${{ env.DOCKER_REGISTRY }} + registry: ${{ secrets.DOCKER_REGISTRY }} username: ${{ secrets.DOCKER_REGISTRY_USER }} password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} @@ -40,7 +40,7 @@ jobs: file: ./docker/Dockerfile platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} + tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} @@ -51,6 +51,6 @@ jobs: file: ./docker/airplay1/Dockerfile platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ env.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}-airplay1 + tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}-airplay1 build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file From 782af5e39549945164b2e2671b1a83d43dc93783 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:43:53 +0100 Subject: [PATCH 05/22] Trigger test run. --- docker/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/README.md b/docker/README.md index 87c26f99..883c74af 100644 --- a/docker/README.md +++ b/docker/README.md @@ -35,4 +35,5 @@ docker buildx build --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg S `SHAIRPORT_SYNC_BRANCH` is required to ensure the image is built using the expected branch. ## AirPlay 1 Only + The AirPlay1 only dockerfile is in the `airplay1` folder. This also includes the `start.sh` script used by the container. \ No newline at end of file From 99c74482f8d13fffebc9bf65e102fb58e7f06e13 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:52:21 +0100 Subject: [PATCH 06/22] Comments. --- .github/workflows/docker-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index fe14f93c..dc27674f 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -1,5 +1,5 @@ # Builds & pushes a docker image when a commit is made to one of the branches specified below. -# Tag pattern: 'unstable-[BRANCH NAME]'. +# Tag pattern: 'unstable-[BRANCH NAME]' & 'unstable-[BRANCH NAME]-airplay1' # See docker-build-releases.yaml for release build process. name: Build and push docker image based on commit to specified branches. From 932713b243bc9c3c7e1c9802c1a6039828842b6b Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 18:53:27 +0100 Subject: [PATCH 07/22] Updated nqptp clone. --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 210d4868..8dc5fe1e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -52,7 +52,7 @@ 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 -RUN git clone git@github.com:mikebrady/nqptp.git +RUN git clone https://github.com/mikebrady/nqptp WORKDIR /nqptp # Use development branch for now. RUN git checkout development From bd82293c4b54bccd919a07164c7a9d07c526058e Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:06:10 +0100 Subject: [PATCH 08/22] Added nqptp branch switching. --- .github/workflows/docker-build-releases.yaml | 8 +++++++- .github/workflows/docker-build.yaml | 8 +++++++- docker/Dockerfile | 8 +++++--- docker/README.md | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index a9da88e4..6fe5c7e3 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -19,9 +19,15 @@ jobs: with: fetch-depth: 0 - - name: Set SHAIRPORT_SYNC_BRANCH env. + - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + run: echo "NQPTP_BRANCH=development" + + - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + run: echo "NQPTP_BRANCH=master" + - name: Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index dc27674f..d40636a0 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -17,9 +17,15 @@ jobs: with: fetch-depth: 0 - - name: Set SHAIRPORT_SYNC_BRANCH env. + - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV + - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + run: echo "NQPTP_BRANCH=development" + + - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + run: echo "NQPTP_BRANCH=master" + - name: Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/docker/Dockerfile b/docker/Dockerfile index 8dc5fe1e..98a3900c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -43,10 +43,12 @@ 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. +# These will be modified 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" 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 @@ -55,7 +57,7 @@ COPY --from=builder-alac /usr/local/include /usr/local/include RUN git clone https://github.com/mikebrady/nqptp WORKDIR /nqptp # Use development branch for now. -RUN git checkout development +RUN git checkout "$NQPTP_BRANCH" RUN autoreconf -fi RUN ./configure RUN make diff --git a/docker/README.md b/docker/README.md index 883c74af..25df20ec 100644 --- a/docker/README.md +++ b/docker/README.md @@ -29,7 +29,7 @@ Edit the configuration file `/etc/shairport-sync.conf` in the container (or use ## Build Example (for arm7 devices) ``` -docker buildx build --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg SHAIRPORT_SYNC_BRANCH=development -t shairport-sync:unstable-development . +docker buildx build --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg SHAIRPORT_SYNC_BRANCH=development --build-arg NQPTP_BRANCH=development -t shairport-sync:unstable-development . ``` `SHAIRPORT_SYNC_BRANCH` is required to ensure the image is built using the expected branch. From 60afdc09849da0396a48423b21367da26f227dd6 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:09:45 +0100 Subject: [PATCH 09/22] Use github ref. --- .github/workflows/docker-build-releases.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 6fe5c7e3..43bd7927 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -22,10 +22,10 @@ jobs: - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + - if: github.ref == 'development' run: echo "NQPTP_BRANCH=development" - - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + - if: github.ref != 'development' run: echo "NQPTP_BRANCH=master" - name: Set up QEMU From 15f0bb34dc81d127b0f77df95e37bde6f55908b1 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:11:42 +0100 Subject: [PATCH 10/22] Use github ref 2. --- .github/workflows/docker-build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index d40636a0..f6c2481e 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -20,10 +20,10 @@ jobs: - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + - if: github.ref == 'development' run: echo "NQPTP_BRANCH=development" - - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + - if: github.ref != 'development' run: echo "NQPTP_BRANCH=master" - name: Set up QEMU From 5bcf0d563f17ef72b73eb7fc916282a7506c956a Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:15:37 +0100 Subject: [PATCH 11/22] Use github ref 3. --- .github/workflows/docker-build-releases.yaml | 4 ++-- .github/workflows/docker-build.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 43bd7927..6fe5c7e3 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -22,10 +22,10 @@ jobs: - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - - if: github.ref == 'development' + - if: env.SHAIRPORT_SYNC_BRANCH == 'development' run: echo "NQPTP_BRANCH=development" - - if: github.ref != 'development' + - if: env.SHAIRPORT_SYNC_BRANCH != 'development' run: echo "NQPTP_BRANCH=master" - name: Set up QEMU diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index f6c2481e..d40636a0 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -20,10 +20,10 @@ jobs: - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - - if: github.ref == 'development' + - if: env.SHAIRPORT_SYNC_BRANCH == 'development' run: echo "NQPTP_BRANCH=development" - - if: github.ref != 'development' + - if: env.SHAIRPORT_SYNC_BRANCH != 'development' run: echo "NQPTP_BRANCH=master" - name: Set up QEMU From 799d2e54d8592c92c1b6c55c9aeefc43898e3860 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:17:32 +0100 Subject: [PATCH 12/22] Test. --- .github/workflows/docker-build-releases.yaml | 8 +++++--- .github/workflows/docker-build.yaml | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 6fe5c7e3..b39f4b0e 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -19,13 +19,15 @@ jobs: with: fetch-depth: 0 - - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. + - name: Set SHAIRPORT_SYNC_BRANCH env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + - name: Determine NQPTP env (part 1). + if: env.SHAIRPORT_SYNC_BRANCH == 'development' run: echo "NQPTP_BRANCH=development" - - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + - name: Determine NQPTP env (part 2). + if: env.SHAIRPORT_SYNC_BRANCH != 'development' run: echo "NQPTP_BRANCH=master" - name: Set up QEMU diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index d40636a0..9e95cd0d 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -17,13 +17,15 @@ jobs: with: fetch-depth: 0 - - name: Set SHAIRPORT_SYNC_BRANCH & NQPTP env. + - name: Set SHAIRPORT_SYNC_BRANCH env. run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + - name: Determine NQPTP env (part 1). + if: env.SHAIRPORT_SYNC_BRANCH == 'development' run: echo "NQPTP_BRANCH=development" - - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + - name: Determine NQPTP env (part 2). + if: env.SHAIRPORT_SYNC_BRANCH != 'development' run: echo "NQPTP_BRANCH=master" - name: Set up QEMU From e4a762579ca5710095182d19387fd6741d970745 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:19:24 +0100 Subject: [PATCH 13/22] Test. --- .github/workflows/docker-build-releases.yaml | 6 +++--- .github/workflows/docker-build.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index b39f4b0e..de44e7ea 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -23,13 +23,13 @@ jobs: run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Determine NQPTP env (part 1). - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} run: echo "NQPTP_BRANCH=development" - name: Determine NQPTP env (part 2). - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} run: echo "NQPTP_BRANCH=master" - + - name: Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 9e95cd0d..0fd3b7ef 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -21,11 +21,11 @@ jobs: run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Determine NQPTP env (part 1). - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} run: echo "NQPTP_BRANCH=development" - name: Determine NQPTP env (part 2). - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} run: echo "NQPTP_BRANCH=master" - name: Set up QEMU From e973c782ad27d70dcc8a738f1dca46f194f75e22 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:23:00 +0100 Subject: [PATCH 14/22] Test. --- .github/workflows/docker-build-releases.yaml | 8 ++++---- .github/workflows/docker-build.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index de44e7ea..8ad75497 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -23,12 +23,12 @@ jobs: run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Determine NQPTP env (part 1). - if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} - run: echo "NQPTP_BRANCH=development" + if: env.SHAIRPORT_SYNC_BRANCH == 'development' + run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV - name: Determine NQPTP env (part 2). - if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} - run: echo "NQPTP_BRANCH=master" + if: env.SHAIRPORT_SYNC_BRANCH != 'development' + run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 0fd3b7ef..fad6f5a3 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -21,12 +21,12 @@ jobs: run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Determine NQPTP env (part 1). - if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} - run: echo "NQPTP_BRANCH=development" + if: env.SHAIRPORT_SYNC_BRANCH == 'development' + run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV - name: Determine NQPTP env (part 2). - if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} - run: echo "NQPTP_BRANCH=master" + if: env.SHAIRPORT_SYNC_BRANCH != 'development' + run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v1 From 8eaa80f4fb2e290259913a0d2f33b56c626b5a3b Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:25:01 +0100 Subject: [PATCH 15/22] Test. --- .github/workflows/docker-build-releases.yaml | 4 ++-- .github/workflows/docker-build.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 8ad75497..e20ecc47 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -23,11 +23,11 @@ jobs: run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Determine NQPTP env (part 1). - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV - name: Determine NQPTP env (part 2). - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV - name: Set up QEMU diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index fad6f5a3..b02d0ce1 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -21,13 +21,13 @@ jobs: run: echo "SHAIRPORT_SYNC_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: Determine NQPTP env (part 1). - if: env.SHAIRPORT_SYNC_BRANCH == 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV - name: Determine NQPTP env (part 2). - if: env.SHAIRPORT_SYNC_BRANCH != 'development' + if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV - + - name: Set up QEMU uses: docker/setup-qemu-action@v1 From 19608dbb3b20e3b15bee06e45012cc4fbb9d015a Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:29:20 +0100 Subject: [PATCH 16/22] Test. --- .github/workflows/docker-build-releases.yaml | 7 +++++-- .github/workflows/docker-build.yaml | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index e20ecc47..9d695d99 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -24,11 +24,14 @@ jobs: - name: Determine NQPTP env (part 1). if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} - run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV + env: + NQPTP_BRANCH: development - name: Determine NQPTP env (part 2). if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} - run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV + env: + NQPTP_BRANCH: master + - name: Set up QEMU uses: docker/setup-qemu-action@v1 diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index b02d0ce1..01435a89 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -22,11 +22,13 @@ jobs: - name: Determine NQPTP env (part 1). if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} - run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV + env: + NQPTP_BRANCH: development - name: Determine NQPTP env (part 2). if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} - run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV + env: + NQPTP_BRANCH: master - name: Set up QEMU uses: docker/setup-qemu-action@v1 From f80a5abc15da40605d2056a3f9496b74af222ece Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 19:37:09 +0100 Subject: [PATCH 17/22] Test. --- .github/workflows/docker-build-releases.yaml | 8 +++----- .github/workflows/docker-build.yaml | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 9d695d99..e664d7a9 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -24,14 +24,11 @@ jobs: - name: Determine NQPTP env (part 1). if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} - env: - NQPTP_BRANCH: development + run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV - name: Determine NQPTP env (part 2). if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} - env: - NQPTP_BRANCH: master - + run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -56,6 +53,7 @@ jobs: tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:latest ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} + NQPTP_BRANCH=${{ env.NQPTP_BRANCH }} - name: Build and push (AirPlay 1) uses: docker/build-push-action@v2 diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 01435a89..b3d8eebb 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -22,13 +22,11 @@ jobs: - name: Determine NQPTP env (part 1). if: ${{ env.SHAIRPORT_SYNC_BRANCH == 'development' }} - env: - NQPTP_BRANCH: development + run: echo "NQPTP_BRANCH=development" >> $GITHUB_ENV - name: Determine NQPTP env (part 2). if: ${{ env.SHAIRPORT_SYNC_BRANCH != 'development' }} - env: - NQPTP_BRANCH: master + run: echo "NQPTP_BRANCH=master" >> $GITHUB_ENV - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -53,6 +51,7 @@ jobs: tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} + NQPTP_BRANCH=${{ env.NQPTP_BRANCH }} - name: Build and push (AirPlay 1) uses: docker/build-push-action@v2 From 2b313027ba94d4cbb3255bf57aaa009b60f11066 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:09:40 +0100 Subject: [PATCH 18/22] README update. --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 25df20ec..99bd85f2 100644 --- a/docker/README.md +++ b/docker/README.md @@ -36,4 +36,4 @@ docker buildx build --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg S ## AirPlay 1 Only -The AirPlay1 only dockerfile is in the `airplay1` folder. This also includes the `start.sh` script used by the container. \ No newline at end of file +The AirPlay1 only dockerfile is in the `airplay1` folder. This also includes the `start.sh` script used by the container. Please note that the AirPlay 1 image build via the AirPlay 2 branch does not work with multiple instances on the same hardware. \ No newline at end of file From 7d43349f748c6df1b0bf4b1f2867a54cd4e760fb Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:18:42 +0100 Subject: [PATCH 19/22] Test. --- docker/airplay1/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/airplay1/README.md b/docker/airplay1/README.md index 1d68a959..f8335d76 100644 --- a/docker/airplay1/README.md +++ b/docker/airplay1/README.md @@ -1,3 +1,3 @@ # AirPlay 1 Only Docker Image -See the [Shairport Sync Docker Hub Repo](https://hub.docker.com/r/mikebrady/shairport-sync) for available tags. \ No newline at end of file +See the [Shairport Sync Docker Hub Repo](https://hub.docker.com/r/mikebrady/shairport-sync) for available tags. From f634cc816cc7b9cf2eee39d1c092fba0743b8eca Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:22:13 +0100 Subject: [PATCH 20/22] Compatibility with docker hub. --- .github/workflows/docker-build-releases.yaml | 4 ++-- .github/workflows/docker-build.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index e664d7a9..59ef477e 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -50,7 +50,7 @@ jobs: file: ./docker/Dockerfile platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:latest ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }} + tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:latest ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:${{ github.event.release.tag_name }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} NQPTP_BRANCH=${{ env.NQPTP_BRANCH }} @@ -62,6 +62,6 @@ jobs: file: ./docker/airplay1/Dockerfile-AirPlay1 platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:latest-airplay1, ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:${{ github.event.release.tag_name }}-airplay1 + tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:latest-airplay1, ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:${{ github.event.release.tag_name }}-airplay1 build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index b3d8eebb..c2d33331 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -48,7 +48,7 @@ jobs: file: ./docker/Dockerfile platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} + tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} NQPTP_BRANCH=${{ env.NQPTP_BRANCH }} @@ -60,6 +60,6 @@ jobs: file: ./docker/airplay1/Dockerfile platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}-airplay1 + tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}-airplay1 build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file From 58f0c34930a2a254a4b34ac488a592ef1ee14e40 Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:38:49 +0100 Subject: [PATCH 21/22] Centralised docker image name. --- .github/workflows/docker-build-releases.yaml | 11 +++++++---- .github/workflows/docker-build.yaml | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker-build-releases.yaml b/.github/workflows/docker-build-releases.yaml index 59ef477e..ef355fa8 100644 --- a/.github/workflows/docker-build-releases.yaml +++ b/.github/workflows/docker-build-releases.yaml @@ -10,6 +10,9 @@ on: release: types: [ ] +env: + DOCKER_PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 + jobs: main: runs-on: ubuntu-latest @@ -48,9 +51,9 @@ jobs: with: context: ./ file: ./docker/Dockerfile - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 + platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:latest ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:${{ github.event.release.tag_name }} + tags: ${{ secrets.DOCKER_IMAGE_NAME }}:latest ${{ secrets.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} NQPTP_BRANCH=${{ env.NQPTP_BRANCH }} @@ -60,8 +63,8 @@ jobs: with: context: ./ file: ./docker/airplay1/Dockerfile-AirPlay1 - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 + platforms: ${{ env.PLATFORMS }} push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:latest-airplay1, ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:${{ github.event.release.tag_name }}-airplay1 + tags: ${{ secrets.DOCKER_IMAGE_NAME }}:latest-airplay1, ${{ secrets.DOCKER_IMAGE_NAME }}:${{ github.event.release.tag_name }}-airplay1 build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index c2d33331..af394e1c 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -7,6 +7,9 @@ name: Build and push docker image based on commit to specified branches. on: push: branches: [ development ] + +env: + DOCKER_PLATFORMS: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 jobs: main: @@ -46,9 +49,9 @@ jobs: with: context: ./ file: ./docker/Dockerfile - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 + platforms: ${{ env.DOCKER_PLATFORMS }} push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} + tags: ${{ secrets.DOCKER_IMAGE_NAME }}:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }} build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} NQPTP_BRANCH=${{ env.NQPTP_BRANCH }} @@ -58,8 +61,8 @@ jobs: with: context: ./ file: ./docker/airplay1/Dockerfile - platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm64,linux/arm/v7 + platforms: ${{ env.DOCKER_PLATFORMS }} push: true - tags: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REGISTRY_USER }}/shairport-sync:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}-airplay1 + tags: ${{ secrets.DOCKER_IMAGE_NAME }}:unstable-${{ env.SHAIRPORT_SYNC_BRANCH }}-airplay1 build-args: | SHAIRPORT_SYNC_BRANCH=${{ env.SHAIRPORT_SYNC_BRANCH }} \ No newline at end of file From 4b2518bbdd7d7b9757560163f6210db0316a591a Mon Sep 17 00:00:00 2001 From: Charles <32498151+charlesomer@users.noreply.github.com> Date: Thu, 8 Jul 2021 20:51:44 +0100 Subject: [PATCH 22/22] Updated README. --- docker/README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 99bd85f2..6043cc44 100644 --- a/docker/README.md +++ b/docker/README.md @@ -36,4 +36,12 @@ docker buildx build --platform linux/arm/v7 -f ./docker/Dockerfile --build-arg S ## AirPlay 1 Only -The AirPlay1 only dockerfile is in the `airplay1` folder. This also includes the `start.sh` script used by the container. Please note that the AirPlay 1 image build via the AirPlay 2 branch does not work with multiple instances on the same hardware. \ No newline at end of file +The AirPlay1 only dockerfile is in the `airplay1` folder. This also includes the `start.sh` script used by the container. Please note that the AirPlay 1 image build via the AirPlay 2 branch does not work with multiple instances on the same hardware. + +## 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. \ No newline at end of file