From dacca507e4fc82996a15568557c6c7e2e21266e9 Mon Sep 17 00:00:00 2001 From: Tuschl Date: Mon, 9 Jan 2023 00:45:31 +0100 Subject: [PATCH] Add build args to control the subsonic version This commit adds docker build args for controlling the Subsonic binary download and refactors the download logic, such that docker images for multiple specific Subsonic versions can be built more easily. Also, this adds a safety check on the downloaded binary, by comparing the SHA-256 of the downloaded archive against specified value. These args can be used to build multiple images with different subsonic versions like so: ```sh docker build -t subsonic-docker:6.1.5 \ --build-arg DL_VERSION=6.1.5 \ --build-arg DL_SHA256=662463f291c747cbea7e7a8b34f3fd65f19ecbbefdff18dedeacc3d23a75e3f7 docker build -t subsonic-docker:6.1.4 \ --build-arg DL_VERSION=6.1.4 \ --build-arg DL_SHA256=2b1998982d8424f115841aa30ab85f9d35a18f9dc38ac62d50f5834a17293a6e ``` Available versions and SHA-256 value can be taken from the official Subsonic download page: http://www.subsonic.org/pages/download.jsp --- Dockerfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 75b9530..6de5499 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,16 @@ FROM ubuntu:latest LABEL version="1.1" maintainer="John Stucklen " +ARG DL_BASE_URL=https://s3-eu-west-1.amazonaws.com/subsonic-public/download +ARG DL_VERSION=6.1.6 +ARG DL_SHA256=dfb78fa9bb38f2265f498122846b1d6121f7666035a78dbe3a24305bd16c18a0 + ENV LC_ALL en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en ENV SUBSONIC_UID 1000 ENV SUBSONIC_GID 1000 +ENV SUBSONIC_VERSION $DL_VERSION RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update \ @@ -19,9 +24,10 @@ RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 RUN mkdir -p /opt/subsonic \ - && wget --no-check-certificate https://s3-eu-west-1.amazonaws.com/subsonic-public/download/subsonic-6.1.6-standalone.tar.gz \ - && tar xvzf subsonic-6.1.6-standalone.tar.gz -C /opt/subsonic \ - && rm -rf subsonic-6.1.6-standalone.tar.gz + && wget --no-check-certificate $DL_BASE_URL/subsonic-$DL_VERSION-standalone.tar.gz \ + && echo $DL_SHA256 *subsonic-$DL_VERSION-standalone.tar.gz | sha256sum -c - \ + && tar xvzf subsonic-$DL_VERSION-standalone.tar.gz -C /opt/subsonic \ + && rm -rf subsonic-$DL_VERSION-standalone.tar.gz COPY mikmod_stdout /opt/subsonic COPY timidity_stdout /opt/subsonic