From 061ab6f1bdfa5d2053d6c8c93ba028c228590940 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 17 Aug 2020 13:35:38 -0400 Subject: [PATCH 1/6] run from source with python instead of ppa --- Dockerfile | 30 +++++++++++++++--------------- Dockerfile.aarch64 | 30 +++++++++++++++--------------- Dockerfile.armhf | 30 +++++++++++++++--------------- Jenkinsfile | 2 +- jenkins-vars.yml | 2 +- root/etc/services.d/sabnzbd/run | 2 +- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e70dda..310d555 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,33 +24,33 @@ RUN \ echo "deb http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \ echo "deb-src http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \ echo "**** install packages ****" && \ - if [ -z ${SABNZBD_VERSION+x} ]; then \ - SABNZBD="sabnzbdplus"; \ - else \ - SABNZBD_CLEAN=$(echo "${SABNZBD_VERSION}"| sed 's/..$//') && \ - SABNZBD="sabnzbdplus=${SABNZBD_CLEAN}"; \ - fi && \ apt-get update && \ apt-get install -y \ + jq \ p7zip-full \ par2-tbb \ python3 \ python3-pip \ - ${SABNZBD} \ unrar \ unzip && \ - pip3 install --no-cache-dir \ - apprise \ - chardet \ - pynzb \ - requests \ - sabyenc && \ + if [ -z ${SABNZBD_VERSION+x} ]; then \ + SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ + | jq -r 'first(.[]) | .tag_name'); \ + fi && \ + mkdir -p /app/sabnzbd && \ + curl -o \ + /tmp/sabnzbd.tar.gz -L \ + "https://github.com/sabnzbd/sabnzbd/releases/download/${SABNZBD_VERSION}/SABnzbd-${SABNZBD_VERSION}-src.tar.gz" && \ + tar xf \ + /tmp/sabnzbd.tar.gz -C \ + /app/sabnzbd --strip-components=1 && \ + cd /app/sabnzbd && \ + pip3 install -U pip && \ + pip install -U --no-cache-dir -r requirements.txt && \ echo "**** cleanup ****" && \ ln -s \ /usr/bin/python3 \ /usr/bin/python && \ - apt-get purge --auto-remove -y \ - python3-pip && \ apt-get clean && \ rm -rf \ /tmp/* \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 6356525..479abca 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -24,33 +24,33 @@ RUN \ echo "deb http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \ echo "deb-src http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \ echo "**** install packages ****" && \ - if [ -z ${SABNZBD_VERSION+x} ]; then \ - SABNZBD="sabnzbdplus"; \ - else \ - SABNZBD_CLEAN=$(echo "${SABNZBD_VERSION}"| sed 's/..$//') && \ - SABNZBD="sabnzbdplus=${SABNZBD_CLEAN}"; \ - fi && \ apt-get update && \ apt-get install -y \ + jq \ p7zip-full \ par2-tbb \ python3 \ python3-pip \ - ${SABNZBD} \ unrar \ unzip && \ - pip3 install --no-cache-dir \ - apprise \ - chardet \ - pynzb \ - requests \ - sabyenc && \ + if [ -z ${SABNZBD_VERSION+x} ]; then \ + SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ + | jq -r 'first(.[]) | .tag_name'); \ + fi && \ + mkdir -p /app/sabnzbd && \ + curl -o \ + /tmp/sabnzbd.tar.gz -L \ + "https://github.com/sabnzbd/sabnzbd/releases/download/${SABNZBD_VERSION}/SABnzbd-${SABNZBD_VERSION}-src.tar.gz" && \ + tar xf \ + /tmp/sabnzbd.tar.gz -C \ + /app/sabnzbd --strip-components=1 && \ + cd /app/sabnzbd && \ + pip3 install -U pip && \ + pip install -U --no-cache-dir -r requirements.txt && \ echo "**** cleanup ****" && \ ln -s \ /usr/bin/python3 \ /usr/bin/python && \ - apt-get purge --auto-remove -y \ - python3-pip && \ apt-get clean && \ rm -rf \ /tmp/* \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 28fe918..23b76e1 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -24,33 +24,33 @@ RUN \ echo "deb http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \ echo "deb-src http://ppa.launchpad.net/jcfp/sab-addons/ubuntu bionic main" >> /etc/apt/sources.list.d/sabnzbd.list && \ echo "**** install packages ****" && \ - if [ -z ${SABNZBD_VERSION+x} ]; then \ - SABNZBD="sabnzbdplus"; \ - else \ - SABNZBD_CLEAN=$(echo "${SABNZBD_VERSION}"| sed 's/..$//') && \ - SABNZBD="sabnzbdplus=${SABNZBD_CLEAN}"; \ - fi && \ apt-get update && \ apt-get install -y \ + jq \ p7zip-full \ par2-tbb \ python3 \ python3-pip \ - ${SABNZBD} \ unrar \ unzip && \ - pip3 install --no-cache-dir \ - apprise \ - chardet \ - pynzb \ - requests \ - sabyenc && \ + if [ -z ${SABNZBD_VERSION+x} ]; then \ + SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ + | jq -r 'first(.[]) | .tag_name'); \ + fi && \ + mkdir -p /app/sabnzbd && \ + curl -o \ + /tmp/sabnzbd.tar.gz -L \ + "https://github.com/sabnzbd/sabnzbd/releases/download/${SABNZBD_VERSION}/SABnzbd-${SABNZBD_VERSION}-src.tar.gz" && \ + tar xf \ + /tmp/sabnzbd.tar.gz -C \ + /app/sabnzbd --strip-components=1 && \ + cd /app/sabnzbd && \ + pip3 install -U pip && \ + pip install -U --no-cache-dir -r requirements.txt && \ echo "**** cleanup ****" && \ ln -s \ /usr/bin/python3 \ /usr/bin/python && \ - apt-get purge --auto-remove -y \ - python3-pip && \ apt-get clean && \ rm -rf \ /tmp/* \ diff --git a/Jenkinsfile b/Jenkinsfile index c1c317d..6c64ea0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -103,7 +103,7 @@ pipeline { steps{ script{ env.EXT_RELEASE = sh( - script: ''' curl -sX GET http://ppa.launchpad.net/jcfp/ppa/ubuntu/dists/bionic/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: sabnzbdplus' | awk -F ': ' '/Version/{print $2;exit}' | sed 's/$/-u/' ''', + script: ''' curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases | jq -r 'first(.[]) | .tag_name' ''', returnStdout: true).trim() env.RELEASE_LINK = 'custom_command' } diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 1e4f9be..87a6887 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -3,7 +3,7 @@ # jenkins variables project_name: docker-sabnzbd external_type: na -custom_version_command: "curl -sX GET http://ppa.launchpad.net/jcfp/ppa/ubuntu/dists/bionic/main/binary-amd64/Packages.gz | gunzip |grep -A 7 -m 1 'Package: sabnzbdplus' | awk -F ': ' '/Version/{print $2;exit}' | sed 's/$/-u/'" +custom_version_command: "curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases | jq -r 'first(.[]) | .tag_name'" release_type: prerelease release_tag: unstable ls_branch: unstable diff --git a/root/etc/services.d/sabnzbd/run b/root/etc/services.d/sabnzbd/run index 1a88e63..5c18516 100644 --- a/root/etc/services.d/sabnzbd/run +++ b/root/etc/services.d/sabnzbd/run @@ -1,7 +1,7 @@ #!/usr/bin/with-contenv bash exec \ - s6-setuidgid abc /usr/bin/sabnzbdplus \ + s6-setuidgid abc python3 /app/sabnzbd/SABnzbd.py \ --config-file /config --server 0.0.0.0:8080 From 174e19b10752952862a3041dcdf063e95d95d415 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 17 Aug 2020 14:30:05 -0400 Subject: [PATCH 2/6] add cryptography build depends --- Dockerfile | 5 +++++ Dockerfile.aarch64 | 5 +++++ Dockerfile.armhf | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/Dockerfile b/Dockerfile index 310d555..7f787da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,8 @@ RUN \ apt-get update && \ apt-get install -y \ jq \ + libffi-dev \ + libssl-dev \ p7zip-full \ par2-tbb \ python3 \ @@ -51,6 +53,9 @@ RUN \ ln -s \ /usr/bin/python3 \ /usr/bin/python && \ + apt-get purge --auto-remove -y \ + libffi-dev \ + libssl-dev && \ apt-get clean && \ rm -rf \ /tmp/* \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 479abca..1e5182c 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -27,6 +27,8 @@ RUN \ apt-get update && \ apt-get install -y \ jq \ + libffi-dev \ + libssl-dev \ p7zip-full \ par2-tbb \ python3 \ @@ -51,6 +53,9 @@ RUN \ ln -s \ /usr/bin/python3 \ /usr/bin/python && \ + apt-get purge --auto-remove -y \ + libffi-dev \ + libssl-dev && \ apt-get clean && \ rm -rf \ /tmp/* \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 23b76e1..49c1fcd 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -27,6 +27,8 @@ RUN \ apt-get update && \ apt-get install -y \ jq \ + libffi-dev \ + libssl-dev \ p7zip-full \ par2-tbb \ python3 \ @@ -51,6 +53,9 @@ RUN \ ln -s \ /usr/bin/python3 \ /usr/bin/python && \ + apt-get purge --auto-remove -y \ + libffi-dev \ + libssl-dev && \ apt-get clean && \ rm -rf \ /tmp/* \ From 9c2b77a18df703bd74e824296341aaacd9eb898e Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 17 Aug 2020 14:43:10 -0400 Subject: [PATCH 3/6] reduce image size by removing py3-pip --- Dockerfile | 4 +++- Dockerfile.aarch64 | 4 +++- Dockerfile.armhf | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f787da..7abcb6e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,7 @@ RUN \ par2-tbb \ python3 \ python3-pip \ + python3-six \ unrar \ unzip && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ @@ -55,7 +56,8 @@ RUN \ /usr/bin/python && \ apt-get purge --auto-remove -y \ libffi-dev \ - libssl-dev && \ + libssl-dev \ + python3-pip && \ apt-get clean && \ rm -rf \ /tmp/* \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 1e5182c..906357c 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -33,6 +33,7 @@ RUN \ par2-tbb \ python3 \ python3-pip \ + python3-six \ unrar \ unzip && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ @@ -55,7 +56,8 @@ RUN \ /usr/bin/python && \ apt-get purge --auto-remove -y \ libffi-dev \ - libssl-dev && \ + libssl-dev \ + python3-pip && \ apt-get clean && \ rm -rf \ /tmp/* \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 49c1fcd..c2d6c6c 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -33,6 +33,7 @@ RUN \ par2-tbb \ python3 \ python3-pip \ + python3-six \ unrar \ unzip && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ @@ -55,7 +56,8 @@ RUN \ /usr/bin/python && \ apt-get purge --auto-remove -y \ libffi-dev \ - libssl-dev && \ + libssl-dev \ + python3-pip && \ apt-get clean && \ rm -rf \ /tmp/* \ From 4d0eaab80d216f9030742386d1cb11cf94a4f768 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 17 Aug 2020 15:05:50 -0400 Subject: [PATCH 4/6] readme update (changelog) --- README.md | 1 + readme-vars.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index a3558c4..0c87cc4 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **17.08.20:** - Switch to running from source with python3 instead of ppa. * **08.05.20:** - Switch to `ppa:jcfp/ppa`. * **03.01.20:** - Use alpha head for unstable with Python3. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. diff --git a/readme-vars.yml b/readme-vars.yml index dc92fec..0474204 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -58,6 +58,7 @@ app_setup_block: | # changelog changelogs: + - { date: "17.08.20:", desc: "Switch to running from source with python3 instead of ppa." } - { date: "08.05.20:", desc: "Switch to `ppa:jcfp/ppa`." } - { date: "03.01.20:", desc: "Use alpha head for unstable with Python3." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } From 4709604b29180782feeb06a5cfb60c13556c40dd Mon Sep 17 00:00:00 2001 From: aptalca Date: Tue, 18 Aug 2020 10:49:13 -0400 Subject: [PATCH 5/6] add additional pip packages, remove unzip --- Dockerfile | 7 +++++-- Dockerfile.aarch64 | 7 +++++-- Dockerfile.armhf | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7abcb6e..d985ac8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,7 @@ RUN \ python3 \ python3-pip \ python3-six \ - unrar \ - unzip && \ + unrar && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ | jq -r 'first(.[]) | .tag_name'); \ @@ -49,6 +48,10 @@ RUN \ /app/sabnzbd --strip-components=1 && \ cd /app/sabnzbd && \ pip3 install -U pip && \ + pip install -U --no-cache-dir \ + apprise \ + pynzb \ + requests && \ pip install -U --no-cache-dir -r requirements.txt && \ echo "**** cleanup ****" && \ ln -s \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 906357c..b6f8db0 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -34,8 +34,7 @@ RUN \ python3 \ python3-pip \ python3-six \ - unrar \ - unzip && \ + unrar && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ | jq -r 'first(.[]) | .tag_name'); \ @@ -49,6 +48,10 @@ RUN \ /app/sabnzbd --strip-components=1 && \ cd /app/sabnzbd && \ pip3 install -U pip && \ + pip install -U --no-cache-dir \ + apprise \ + pynzb \ + requests && \ pip install -U --no-cache-dir -r requirements.txt && \ echo "**** cleanup ****" && \ ln -s \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index c2d6c6c..14840d9 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -34,8 +34,7 @@ RUN \ python3 \ python3-pip \ python3-six \ - unrar \ - unzip && \ + unrar && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ | jq -r 'first(.[]) | .tag_name'); \ @@ -49,6 +48,10 @@ RUN \ /app/sabnzbd --strip-components=1 && \ cd /app/sabnzbd && \ pip3 install -U pip && \ + pip install -U --no-cache-dir \ + apprise \ + pynzb \ + requests && \ pip install -U --no-cache-dir -r requirements.txt && \ echo "**** cleanup ****" && \ ln -s \ From 5edf5319b0a9d0559716131cf59a59e920811f15 Mon Sep 17 00:00:00 2001 From: aptalca Date: Tue, 18 Aug 2020 16:28:43 -0400 Subject: [PATCH 6/6] fix python dependencies --- Dockerfile | 3 ++- Dockerfile.aarch64 | 3 ++- Dockerfile.armhf | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index d985ac8..f517be5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,8 +32,9 @@ RUN \ p7zip-full \ par2-tbb \ python3 \ + python3-cryptography \ + python3-distutils \ python3-pip \ - python3-six \ unrar && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index b6f8db0..58a5217 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -32,8 +32,9 @@ RUN \ p7zip-full \ par2-tbb \ python3 \ + python3-cryptography \ + python3-distutils \ python3-pip \ - python3-six \ unrar && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 14840d9..01aebd0 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -32,8 +32,9 @@ RUN \ p7zip-full \ par2-tbb \ python3 \ + python3-cryptography \ + python3-distutils \ python3-pip \ - python3-six \ unrar && \ if [ -z ${SABNZBD_VERSION+x} ]; then \ SABNZBD_VERSION=$(curl -s https://api.github.com/repos/sabnzbd/sabnzbd/releases \