add user/password support, run deluge as separate user

This commit is contained in:
gmega 2024-11-01 18:08:29 -03:00
parent 398cde6f22
commit 090b77c5af
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18
1 changed files with 17 additions and 5 deletions

View File

@ -1,15 +1,26 @@
# It's easier to use miniconda or we'll have to build python-boost manually. # It's easier to use miniconda or we'll have to build python-boost manually.
FROM continuumio/miniconda3:24.9.2-0 FROM continuumio/miniconda3:24.9.2-0
ARG UID=1000
ARG GID=1000
ENV DELUGE_APP=/opt/deluge ENV DELUGE_APP=/opt/deluge
ENV DELUGE_CONFIG_DIR=/var/lib/deluge ENV DELUGE_CONFIG_DIR=/var/lib/deluge
ENV DELUGE_DOWNLOAD_DIR=/var/lib/deluge/downloads ENV DELUGE_DOWNLOAD_DIR=${DELUGE_CONFIG_DIR}/downloads
ENV DELUGE_TORRENTFILE_DIR=/var/lib/deluge/downloads ENV DELUGE_TORRENTFILE_DIR=${DELUGE_CONFIG_DIR}/downloads
ENV DELUGE_PLUGINS_DIR=/var/lib/deluge/plugins ENV DELUGE_PLUGINS_DIR=${DELUGE_CONFIG_DIR}/plugins
ENV DELUGE_RPC_PORT=6890 ENV DELUGE_RPC_PORT=6890
ENV DELUGE_LISTEN_PORTS=6891,6892 ENV DELUGE_LISTEN_PORTS=6891,6892
ENV DELUGE_DAEMON_USERNAME=user
ENV DELUGE_DAEMON_PASSWORD=password
RUN mkdir -p ${DELUGE_APP} RUN mkdir -p ${DELUGE_APP} ${DELUGE_CONFIG_DIR}
RUN groupadd -g ${GID} deluge_user \
&& useradd -u ${UID} -g ${GID} -s /bin/bash -m deluge_user \
&& chown -R deluge_user:deluge_user /var/lib/deluge /opt/deluge
USER deluge_user
WORKDIR ${DELUGE_APP} WORKDIR ${DELUGE_APP}
# SHELL modifies the shell form to a login shell so we # SHELL modifies the shell form to a login shell so we
@ -27,7 +38,8 @@ RUN conda install -y anaconda::py-boost\
anaconda::gxx_linux-64\ anaconda::gxx_linux-64\
anaconda:openssl anaconda:openssl
COPY . ./ COPY --chown=deluge_user:deluge_user . ./
RUN git submodule update --init --recursive &&\ RUN git submodule update --init --recursive &&\
cd vendor/libtorrent/bindings/python &&\ cd vendor/libtorrent/bindings/python &&\
python setup.py build_ext install python setup.py build_ext install