deluge/Dockerfile
Arnaud G. GIBERT 2f66143916 - Initial release,
- Based on rx3-docker/server:1.2.2-mga9 image,
- Support Docker Tools 1.4.x.
2025-05-23 13:33:16 +02:00

97 lines
10 KiB
Docker

# Rx3-Docker/Deluge Dockerfile
#-------------------------------------------------------------------------------
ARG IMG_FROM_URL="rx3-docker/server:latest"
FROM ${IMG_FROM_URL}
ARG IMG_NAME
ARG IMG_NAME_FULL
ARG IMG_VERSION
ARG IMG_MAINTAINER
LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER}
ARG DELUGE_PORT_DAEMON
ARG DELUGE_PORT_WEB
ARG DELUGE_LIB=/var/lib/deluge
ARG DELUGE_SPOOL=/var/spool/deluge
ARG DELUGE_HOME=${DELUGE_LIB}
ARG DELUGE_CONFIG=${DELUGE_HOME}
ARG DELUGE_CONFIG_TEMPLATE=${DELUGE_HOME}-template
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ARG DELUGED='#!/bin/bash \n\
\n\
usermod -u ${DELUGE_UID} deluge \n\
groupmod -g ${DELUGE_GID} deluge \n\
\n\
if [[ ! -f '${DELUGE_CONFIG}'/auth ]] \n\
then \n\
cp -R '${DELUGE_CONFIG_TEMPLATE}'/* '${DELUGE_CONFIG}' \n\
\n\
deluged --config '${DELUGE_CONFIG}' \n\
\n\
deluge-console --config '${DELUGE_CONFIG}' config --set allow_remote true \n\
deluge-console --config '${DELUGE_CONFIG}' config --set copy_torrent_file true \n\
deluge-console --config '${DELUGE_CONFIG}' config --set move_completed true \n\
\n\
deluge-console --config '${DELUGE_CONFIG}' config --set listen_ports "[${DELUGE_PORT_BT_LOW},${DELUGE_PORT_BT_HIGH}]" \n\
\n\
deluge-console --config '${DELUGE_CONFIG}' config --set download_location '${DELUGE_SPOOL}'/tmp \n\
deluge-console --config '${DELUGE_CONFIG}' config --set move_completed_path '${DELUGE_SPOOL}'/completed \n\
deluge-console --config '${DELUGE_CONFIG}' config --set plugins_location '${DELUGE_CONFIG}'/plugins \n\
deluge-console --config '${DELUGE_CONFIG}' config --set torrentfiles_location '${DELUGE_SPOOL}'/torrent \n\
\n\
deluge-console --config '${DELUGE_CONFIG}' plugin --enable Label Stats WebUi \n\
\n\
deluge-console --config '${DELUGE_CONFIG}' halt \n\
\n\
echo "deluge:delugeadmin:10" >> '${DELUGE_CONFIG}'/auth \n\
\n\
echo "{\n \"file\": 1,\n \"format\": 1\n}{\n \"enabled\": true,\n \"port\": '${DELUGE_PORT_WEB}',\n \"ssl\": false\n}" > '${DELUGE_CONFIG}'/web_plugin.conf \n\
fi \n\
\n\
for dir in torrent tmp completed \n\
do \n\
if [[ ! -d '${DELUGE_SPOOL}'/${dir} ]] \n\
then \n\
mkdir '${DELUGE_SPOOL}'/${dir} \n\
fi \n\
done \n\
\n\
chown -R deluge:deluge '${DELUGE_LIB}' '${DELUGE_SPOOL}
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ARG DELUGED_INI='[program:deluged] \n\
directory='${DELUGE_HOME}' \n\
command=deluged --config '${DELUGE_CONFIG}' --do-not-daemonize \n\
user=deluge \n\
environment=HOME='${DELUGE_HOME}
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
RUN urpmi.update -a \
&& urpmi --force deluge myip --no-recommends \
&& useradd --home-dir ${DELUGE_HOME} --password "" deluge \
&& mkdir ${DELUGE_SPOOL} \
&& echo -e "${DELUGED}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/init.d/deluged \
&& chmod a+x /etc/init.d/deluged \
&& ln -s /etc/init.d/deluged /etc/rcD.d/S30deluged \
&& echo -e "${DELUGED_INI}" | sed -e "s/\`/'/g" -e 's/ *$//' > /etc/supervisord.d/deluged.ini \
&& deluged --config ${DELUGE_CONFIG_TEMPLATE} \
&& deluge-console --config ${DELUGE_CONFIG_TEMPLATE} halt
EXPOSE ${DELUGE_PORT_DAEMON}
EXPOSE ${DELUGE_PORT_WEB}