From f84a0e33136287a60bd4a702ab6839813cd234fe Mon Sep 17 00:00:00 2001 From: kerta1n <36344851+kerta1n@users.noreply.github.com> Date: Thu, 19 Feb 2026 17:42:05 -0500 Subject: [PATCH 1/4] Add GitHub Actions workflow for Docker image updates --- .github/workflows/update-and-build-image.yml | 109 +++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 .github/workflows/update-and-build-image.yml diff --git a/.github/workflows/update-and-build-image.yml b/.github/workflows/update-and-build-image.yml new file mode 100644 index 0000000..92db8f2 --- /dev/null +++ b/.github/workflows/update-and-build-image.yml @@ -0,0 +1,109 @@ +name: Update and build Docker image + +on: + schedule: + - cron: '0 7 * * 4' # every Thursday at 07:00 UTC + workflow_dispatch: # allow manual trigger + +jobs: + check-update: + runs-on: ubuntu-slim + permissions: + contents: write + outputs: + bumped: ${{ steps.compare.outputs.bumped }} + version: ${{ steps.compare.outputs.version }} + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Fetch latest snapcast-server version from Alpine + id: get_version + run: | + # Version is wrapped in tags on the Alpine package page + VERSION=$(curl -fsSL "https://pkgs.alpinelinux.org/package/edge/community/x86/snapcast-server" \ + | grep -oP '(?<=)[0-9]+.[0-9]+.[0-9]+-r[0-9]+(?=)' \ + | head -n1) + + if [ -z "$VERSION" ]; then + echo "ERROR: Could not parse version from Alpine package page." >&2 + exit 1 + fi + + echo "Latest version: $VERSION" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Compare versions and update Dockerfile if changed + id: compare + run: | + CURRENT=$(grep -oP '(?<=SNAPCAST_VERSION=)[^\s"]+' Dockerfile | head -n1) + NEW="${{ steps.get_version.outputs.version }}" + echo "Current: $CURRENT / Latest: $NEW" + + if [ "$CURRENT" = "$NEW" ]; then + echo "No update needed." + echo "bumped=false" >> "$GITHUB_OUTPUT" + echo "version=$CURRENT" >> "$GITHUB_OUTPUT" + else + sed -i "s/ARG SNAPCAST_VERSION=.*/ARG SNAPCAST_VERSION=${NEW}/" Dockerfile + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add Dockerfile + git commit -m "chore: bump snapcast-server to ${NEW}" + git push + echo "bumped=true" >> "$GITHUB_OUTPUT" + echo "version=$NEW" >> "$GITHUB_OUTPUT" + fi + + build: + needs: check-update + if: ${{ needs.check-update.outputs.bumped == 'true' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repo (with submodules) + uses: actions/checkout@v4 + with: + submodules: recursive # pulls data/snapweb automatically + + - name: Extract snapcast version from Dockerfile + id: meta_version + run: | + VERSION=$(grep -oP '(?<=SNAPCAST_VERSION=)[^\s"]+' Dockerfile | head -n1) + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + # Build a "short" tag like 0.34.0 (strip the -rN alpine revision) + SHORT=$(echo "$VERSION" | grep -oP '^[0-9]+\.[0-9]+\.[0-9]+') + echo "short=$SHORT" >> "$GITHUB_OUTPUT" + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up QEMU (for multi-arch builds) + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64,linux/arm/v7 + push: true + provenance: false + # Full alpine version tag (e.g. 0.34.0-r0), short tag (e.g. 0.34.0), and latest + tags: | + ghcr.io/${{ github.repository_owner }}/snapserver-docker:${{ steps.meta_version.outputs.version }} + ghcr.io/${{ github.repository_owner }}/snapserver-docker:${{ steps.meta_version.outputs.short }} + ghcr.io/${{ github.repository_owner }}/snapserver-docker:latest + build-args: | + SNAPCAST_VERSION=${{ steps.meta_version.outputs.version }} From 33b05263bfe42eb351f5d80fc2ac939150c010a2 Mon Sep 17 00:00:00 2001 From: kerta1n <36344851+kerta1n@users.noreply.github.com> Date: Thu, 19 Feb 2026 17:42:32 -0500 Subject: [PATCH 2/4] Update Snapcast version and optimize Dockerfile commands --- Dockerfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 666c25e..b2d9315 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,13 +2,11 @@ FROM alpine:latest LABEL maintainer="kerta1n" -ARG SNAPCAST_VERSION=0.32.3-r0 +ARG SNAPCAST_VERSION=0.34.0-r0 -RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories -RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories +RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \ + && echo "https://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories \ + && apk add --no-cache bash snapcast-server=${SNAPCAST_VERSION} sed -RUN apk add --no-cache bash snapcast-server=${SNAPCAST_VERSION} sed - -#ENV DEVICE_NAME=Snapcast -CMD snapserver -c /etc/snapserver.conf -EXPOSE 1704/tcp 1705/tcp 1780/tcp \ No newline at end of file +CMD ["snapserver", "-c", "/etc/snapserver.conf"] +EXPOSE 1704/tcp 1705/tcp 1780/tcp From ca1cf6c7f905bd271d8ac63268dfccbb91c4d2b6 Mon Sep 17 00:00:00 2001 From: kerta1n <36344851+kerta1n@users.noreply.github.com> Date: Thu, 5 Mar 2026 14:56:44 -0500 Subject: [PATCH 3/4] Fix actions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dockerfile — 2 changes: Added curl and unzip to the apk add line (line 9) Added the snapweb download RUN step (lines 11-17) with unzip -o to force overwrite and avoid the interactive prompt that caused the original build failure Workflow YAML — 2 changes: Line 71: Added ref: ${{ github.ref }} to the build job's checkout — ensures it picks up the new commit if check-update pushed a version bump Lines 74-80: Replaced the Dockerfile-parsing meta_version step with one that uses needs.check-update.outputs.version directly — more robust and avoids reading a potentially stale Dockerfile --- .github/workflows/update-and-build-image.yml | 8 ++++---- Dockerfile | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-and-build-image.yml b/.github/workflows/update-and-build-image.yml index 92db8f2..5da8df2 100644 --- a/.github/workflows/update-and-build-image.yml +++ b/.github/workflows/update-and-build-image.yml @@ -68,14 +68,14 @@ jobs: - name: Checkout repo (with submodules) uses: actions/checkout@v4 with: - submodules: recursive # pulls data/snapweb automatically + ref: ${{ github.ref }} + submodules: recursive - - name: Extract snapcast version from Dockerfile + - name: Derive version tags id: meta_version run: | - VERSION=$(grep -oP '(?<=SNAPCAST_VERSION=)[^\s"]+' Dockerfile | head -n1) + VERSION="${{ needs.check-update.outputs.version }}" echo "version=$VERSION" >> "$GITHUB_OUTPUT" - # Build a "short" tag like 0.34.0 (strip the -rN alpine revision) SHORT=$(echo "$VERSION" | grep -oP '^[0-9]+\.[0-9]+\.[0-9]+') echo "short=$SHORT" >> "$GITHUB_OUTPUT" diff --git a/Dockerfile b/Dockerfile index b2d9315..cb46b02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,15 @@ ARG SNAPCAST_VERSION=0.34.0-r0 RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \ && echo "https://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories \ - && apk add --no-cache bash snapcast-server=${SNAPCAST_VERSION} sed + && apk add --no-cache bash snapcast-server=${SNAPCAST_VERSION} sed curl unzip + +RUN SNAPWEB_VERSION=$(curl -fsSL "https://api.github.com/repos/badaix/snapweb/releases/latest" \ + | sed -n 's/.*"tag_name": "\([^"]*\)".*/\1/p') \ + && curl -fsSL "https://github.com/badaix/snapweb/releases/download/${SNAPWEB_VERSION}/snapweb.zip" \ + -o /tmp/snapweb.zip \ + && mkdir -p /usr/share/snapserver/snapweb \ + && unzip -o /tmp/snapweb.zip -d /usr/share/snapserver/snapweb \ + && rm -f /tmp/snapweb.zip CMD ["snapserver", "-c", "/etc/snapserver.conf"] EXPOSE 1704/tcp 1705/tcp 1780/tcp From d9bbbb1d548da2449c84224d3c4a24bac0399c63 Mon Sep 17 00:00:00 2001 From: kerta1n <36344851+kerta1n@users.noreply.github.com> Date: Thu, 5 Mar 2026 15:37:46 -0500 Subject: [PATCH 4/4] Update Dockerfile --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb46b02..931c96d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,15 +6,15 @@ ARG SNAPCAST_VERSION=0.34.0-r0 RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \ && echo "https://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories \ - && apk add --no-cache bash snapcast-server=${SNAPCAST_VERSION} sed curl unzip - -RUN SNAPWEB_VERSION=$(curl -fsSL "https://api.github.com/repos/badaix/snapweb/releases/latest" \ + && apk add --no-cache bash snapcast-server=${SNAPCAST_VERSION} sed curl unzip \ + && SNAPWEB_VERSION=$(curl -fsSL "https://api.github.com/repos/badaix/snapweb/releases/latest" \ | sed -n 's/.*"tag_name": "\([^"]*\)".*/\1/p') \ && curl -fsSL "https://github.com/badaix/snapweb/releases/download/${SNAPWEB_VERSION}/snapweb.zip" \ -o /tmp/snapweb.zip \ && mkdir -p /usr/share/snapserver/snapweb \ && unzip -o /tmp/snapweb.zip -d /usr/share/snapserver/snapweb \ - && rm -f /tmp/snapweb.zip + && rm -f /tmp/snapweb.zip \ + && apk del curl sed unzip CMD ["snapserver", "-c", "/etc/snapserver.conf"] EXPOSE 1704/tcp 1705/tcp 1780/tcp