Skip to content

Commit

Permalink
use a python-bookworm base without DNS cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jan 16, 2025
1 parent 04521ed commit ca7f8f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 50 deletions.
28 changes: 12 additions & 16 deletions bittorrent-seeder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
FROM alpine:edge
FROM python:3.12-slim-bookworm
LABEL org.opencontainers.image.source=https://github.com/kiwix/container-images

ENV SHELL=bash

RUN set -e \
# add testing repo for qbittorrent-cli
&& echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk update \
&& apk --no-cache add dumb-init bash curl \
&& apk --no-cache add python3 py3-pip \
# the daemon with webui \
&& apk --no-cache add qbittorrent-nox \
# for convenience
&& apk --no-cache add qbittorrent-cli \
# to setup a DNS cache
&& curl -L -o dnsproxy.tar.gz https://github.com/AdguardTeam/dnsproxy/releases/download/v0.74.1/dnsproxy-linux-amd64-v0.74.1.tar.gz \
&& tar x -f dnsproxy.tar.gz --strip-components 2 \
&& mv dnsproxy /usr/bin/
&& apt-get update \
&& apt-get install -y --no-install-recommends \
dumb-init curl apt-transport-https ca-certificates gnupg2 \
# the daemon with webui \
qbittorrent-nox \
# for convenience (qBittorrent-cli)
&& curl -L https://dl.cloudsmith.io/public/qbittorrent-cli/qbittorrent-cli/gpg.F8756541ADDA2B7D.key | apt-key add - \
&& curl -L -o /etc/apt/sources.list.d/qbittorrent-cli.list https://repos.fedarovich.com/debian/bookworm/qbittorrent-cli.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends qbittorrent-cli

ENV SHELL=bash
ENV NO_DAEMON=""
ENV QBT_TORRENTING_PORT=6901
ENV QBT_HOST=localhost
Expand Down
39 changes: 5 additions & 34 deletions bittorrent-seeder/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
#!/bin/sh

function use_dns_cache {
echo "Starting local DNS cache"
dnsproxy \
--cache \
--cache-min-ttl=3600 \
--cache-size=256 \
--hosts-file-enabled \
--ipv6-disabled \
--listen=127.0.0.1 \
--port=53 \
--upstream='https://1.1.1.1/dns-query'

echo "nameserver 127.0.0.1" > /etc/resolv.conf
}
#!/bin/bash

function configure_qbt {
echo "Starting a qbittorrent-nox process (set NO_DAEMON if you dont want to)"
Expand Down Expand Up @@ -83,27 +68,13 @@ GUI\Notifications\TorrentAdded=false
EOF

QBT_CONFIG_FILE=/root/.config/qbt/.qbt.toml
mkdir -p $(dirname $QBT_CONFIG_FILE)
cat <<EOF > $QBT_CONFIG_FILE
[qbittorrent]
addr = "http://${QBT_HOST}:${QBT_PORT}" # qbittorrent webui-api hostname/ip
login = "${QBT_USERNAME}" # qbittorrent webui-api user
password = "${QBT_PASSWORD}" # qbittorrent webui-api password
#basicUser = "user" # qbittorrent webui-api basic auth user
#basicPass = "password" # qbittorrent webui-api basic auth password
[rules]
enabled = true # enable or disable rules
max_active_downloads = 2 # set max active downloads
EOF
# configure qbittorrent-cli (qbt)
qbt settings set url "http://${QBT_HOST}:${QBT_PORT}"
qbt settings set username "${QBT_USERNAME}"
echo "${QBT_PASSWORD}" | qbt settings set password -y

mkdir -p ~/.config/qbt && touch ~/.config/qbt/.qbt.toml
}

if [ ! "x${USE_DNS_CACHE}" = "x" ]; then
use_dns_cache
fi

if [ "x${NO_DAEMON}" = "x" ]; then
configure_qbt
Expand Down

0 comments on commit ca7f8f4

Please sign in to comment.