diff --git a/Dockerfile b/Dockerfile index e3fdb80..16bc59b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,18 +21,17 @@ RUN \ apk add --no-cache --upgrade --virtual=build-dependencies \ build-base && \ echo "**** install packages ****" && \ + if [ -z ${DELUGE_VERSION+x} ]; then \ + DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ + && awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ + fi && \ apk add --no-cache --upgrade --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + deluge==${DELUGE_VERSION} \ python3 \ py3-future \ py3-geoip \ py3-requests \ p7zip && \ - if [ -z ${DELUGE_VERSION+x} ]; then \ - DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ - && awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ - fi && \ - apk add -U --upgrade --no-cache \ - deluge==${DELUGE_VERSION} && \ echo "**** grab GeoIP database ****" && \ curl -L --retry 10 --retry-max-time 60 --retry-all-errors \ "https://mailfud.org/geoip-legacy/GeoIP.dat.gz" \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 1201756..9ea7b46 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -21,18 +21,17 @@ RUN \ apk add --no-cache --upgrade --virtual=build-dependencies \ build-base && \ echo "**** install packages ****" && \ + if [ -z ${DELUGE_VERSION+x} ]; then \ + DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ + && awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ + fi && \ apk add --no-cache --upgrade --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + deluge==${DELUGE_VERSION} \ python3 \ py3-future \ py3-geoip \ py3-requests \ p7zip && \ - if [ -z ${DELUGE_VERSION+x} ]; then \ - DELUGE_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ - && awk '/^P:deluge$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ - fi && \ - apk add -U --upgrade --no-cache \ - deluge==${DELUGE_VERSION} && \ echo "**** grab GeoIP database ****" && \ curl -L --retry 10 --retry-max-time 60 --retry-all-errors \ "https://mailfud.org/geoip-legacy/GeoIP.dat.gz" \ diff --git a/README.md b/README.md index 3ccdacd..316d92a 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Find us at: * Plugin System * Much more... -[![deluge](https://avatars2.githubusercontent.com/u/6733935?v=3&s=200)](http://deluge-torrent.org/) +[![deluge](https://raw.githubusercontent.com/linuxserver/docker-templates/blob/master/linuxserver.io/img/deluge-logo.png)](http://deluge-torrent.org/) ## Supported Architectures @@ -83,6 +83,10 @@ Change the inbound port to 6881 (or whichever port you've mapped for the contain This image can be run with a read-only container filesystem. For details please [read the docs](https://docs.linuxserver.io/misc/read-only/). +## Non-Root Operation + +This image can be run with a non-root user. For details please [read the docs](https://docs.linuxserver.io/misc/non-root/). + ## Usage To help you get started creating a container from this image you can either use docker-compose or the docker cli. @@ -150,6 +154,7 @@ Containers are configured using parameters passed at runtime (such as those abov | `-v /config` | deluge configs | | `-v /downloads` | torrent download directory | | `--read-only=true` | Run container with a read-only filesystem. Please [read the docs](https://docs.linuxserver.io/misc/read-only/). | +| `--user=1000:1000` | Run container with a non-root user. Please [read the docs](https://docs.linuxserver.io/misc/non-root/). | ## Environment variables from files (Docker secrets) @@ -313,6 +318,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **12.01.25:** - Rebase libtorrentv1 branch to Alpine 3.21. * **19.09.24:** - Prevent race condition related delay during container stop. * **26.08.24:** - Add libtorrentv1 tag. * **26.12.23:** - Replace source for GeoIP database. diff --git a/readme-vars.yml b/readme-vars.yml index cbead4b..21c1b14 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -3,7 +3,7 @@ # project information project_name: deluge project_url: "http://deluge-torrent.org/" -project_logo: "https://avatars2.githubusercontent.com/u/6733935?v=3&s=200" +project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/blob/master/linuxserver.io/img/deluge-logo.png" project_blurb: | [{{ project_name|capitalize }}]({{ project_url }}) is a lightweight, Free Software, cross-platform BitTorrent client. @@ -40,6 +40,7 @@ opt_param_usage_include_ports: true opt_param_ports: - {external_port: "58846", internal_port: "58846", port_desc: "Default deluged port for thin client connectivity"} readonly_supported: true +nonroot_supported: true # application setup block app_setup_block_enabled: true app_setup_block: | @@ -92,6 +93,7 @@ init_diagram: | "deluge:latest" <- Base Images # changelog changelogs: + - {date: "12.01.25:", desc: "Rebase libtorrentv1 branch to Alpine 3.21."} - {date: "19.09.24:", desc: "Prevent race condition related delay during container stop."} - {date: "26.08.24:", desc: "Add libtorrentv1 tag."} - {date: "26.12.23:", desc: "Replace source for GeoIP database."} diff --git a/root/etc/s6-overlay/s6-rc.d/init-deluge-config/run b/root/etc/s6-overlay/s6-rc.d/init-deluge-config/run index e15e365..eb214a8 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-deluge-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-deluge-config/run @@ -7,20 +7,21 @@ fi mkdir -p /run/deluged-temp -# permissions -lsiown -R abc:abc \ - /run/deluged-temp \ - /config - -# chown download directory if currently not set to abc -if [[ -d /downloads ]]; then - if [[ "$(stat -c '%U' /downloads)" != "abc" ]]; then - lsiown -R abc:abc /downloads - fi -fi - # create torrents directory if it does not exist if [[ ! -d /config/torrents ]]; then mkdir -p /config/torrents - lsiown abc:abc /config/torrents +fi + +if [[ -z ${LSIO_NON_ROOT_USER} ]]; then + # permissions + lsiown -R abc:abc \ + /run/deluged-temp \ + /config + + # chown download directory if currently not set to abc + if [[ -d /downloads ]]; then + if [[ "$(stat -c '%U' /downloads)" != "abc" ]]; then + lsiown -R abc:abc /downloads + fi + fi fi diff --git a/root/etc/s6-overlay/s6-rc.d/svc-deluge-web/run b/root/etc/s6-overlay/s6-rc.d/svc-deluge-web/run index 55b23bf..4a0b444 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-deluge-web/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-deluge-web/run @@ -7,7 +7,12 @@ if [[ -f /config/web.conf ]]; then DELUGE_WEB_PORT=$(grep 'port"' /config/web.conf | tr -cd "[:digit:]") fi -exec \ - s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGE_WEB_PORT:-8112}" \ - s6-setuidgid abc /usr/bin/deluge-web \ - -d -c /config --loglevel="${DELUGE_LOGLEVEL}" +if [[ -z ${LSIO_NON_ROOT_USER} ]]; then + exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGE_WEB_PORT:-8112}" \ + s6-setuidgid abc /usr/bin/deluge-web -d -c /config --loglevel="${DELUGE_LOGLEVEL}" +else + exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGE_WEB_PORT:-8112}" \ + /usr/bin/deluge-web -d -c /config --loglevel="${DELUGE_LOGLEVEL}" +fi diff --git a/root/etc/s6-overlay/s6-rc.d/svc-deluged/run b/root/etc/s6-overlay/s6-rc.d/svc-deluged/run index 985a9ec..a8526e2 100755 --- a/root/etc/s6-overlay/s6-rc.d/svc-deluged/run +++ b/root/etc/s6-overlay/s6-rc.d/svc-deluged/run @@ -7,7 +7,12 @@ if [[ -f /config/core.conf ]]; then DELUGED_PORT=$(grep '"daemon_port"' /config/core.conf | tr -cd "[:digit:]") fi -exec \ - s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGED_PORT:-58846}" \ - s6-setuidgid abc /usr/bin/deluged -c /config \ - -d --loglevel="${DELUGE_LOGLEVEL}" +if [[ -z ${LSIO_NON_ROOT_USER} ]]; then + exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGED_PORT:-58846}" \ + s6-setuidgid abc /usr/bin/deluged -c /config -d --loglevel="${DELUGE_LOGLEVEL}" +else + exec \ + s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 ${DELUGED_PORT:-58846}" \ + /usr/bin/deluged -c /config -d --loglevel="${DELUGE_LOGLEVEL}" +fi