From d8afd6e6c09d03fdaf86c6bf1225b0feee4d50c0 Mon Sep 17 00:00:00 2001
From: Janne Mareike Koschinski <janne@kuschku.de>
Date: Thu, 9 Jun 2022 03:10:04 +0200
Subject: [PATCH] feat: use jesec rtorrent instead

---
 daemon/Dockerfile    | 46 +++-----------------------------------------
 daemon/entrypoint.sh |  1 +
 2 files changed, 4 insertions(+), 43 deletions(-)

diff --git a/daemon/Dockerfile b/daemon/Dockerfile
index 1a7bb8a..69d4d6a 100644
--- a/daemon/Dockerfile
+++ b/daemon/Dockerfile
@@ -1,43 +1,3 @@
-FROM alpine:3.15 AS builder
-ARG RTORRENT_VERSION=0.9.8
-ARG LIBTORRENT_VERSION=0.13.8
-RUN apk add --no-cache \
-    alpine-sdk \
-    autoconf \
-    automake \
-    curl-dev \
-    libsigc++-dev \
-    libtool \
-    linux-headers \
-    ncurses-dev \
-    openssl-dev \
-    xmlrpc-c-dev \
-    zlib-dev
-
-RUN git clone --branch v${RTORRENT_VERSION} --single-branch https://github.com/rakshasa/rtorrent.git /rtorrent
-RUN git clone --branch v${LIBTORRENT_VERSION} --single-branch https://github.com/rakshasa/libtorrent.git /libtorrent
-
-WORKDIR /libtorrent
-RUN ./autogen.sh && \
-    ./configure \
-        --prefix=/usr \
-        --disable-debug \
-        --disable-instrumentation && \
-    make -j$(nproc) && \
-    mkdir -p /build && \
-    DESTDIR=/build make install && \
-    make install
-
-WORKDIR /rtorrent
-RUN ./autogen.sh && \
-    ./configure \
-        --prefix=/usr \
-        --disable-debug \
-        --with-xmlrpc-c && \
-    make -j$(nproc) && \
-    mkdir -p /build && \
-    DESTDIR=/build make install
-
 FROM alpine:3.15
 
 RUN apk add --no-cache \
@@ -48,13 +8,13 @@ RUN apk add --no-cache \
     ncurses-libs \
     xmlrpc-c
 
-COPY --from=builder /build/usr/bin/rtorrent /usr/bin/rtorrent
-COPY --from=builder /build/usr/lib/libtorrent.so* /usr/lib/
+RUN curl -L https://github.com/jesec/rtorrent/releases/latest/download/rtorrent-linux-amd64 > /usr/bin/rtorrent && \
+    chmod +x /usr/bin/rtorrent
 
 RUN adduser -u 1000 -D rtorrent && \
     addgroup rtorrent rtorrent && \
     mkdir -p /data && chown rtorrent /data && \
-    mkdir -p /private && chown rtorrent /private
+    mkdir -p /session && chown rtorrent /session
 
 USER rtorrent
 
diff --git a/daemon/entrypoint.sh b/daemon/entrypoint.sh
index 7f44c86..f46a00b 100755
--- a/daemon/entrypoint.sh
+++ b/daemon/entrypoint.sh
@@ -6,6 +6,7 @@ rm /session/rtorrent.lock /session/rtorrent.pid || true
 
 if [ -n "$EXTERNAL_IP_CMD" ]; then
   EXTERNAL_IP=$(eval "$EXTERNAL_IP_CMD")
+  echo "external ip: ${EXTERNAL_IP}"
 fi
 if [ -n "$EXTERNAL_IP" ]; then
   rtorrent -i "$EXTERNAL_IP" -n -o "import=/rtorrent.rc" &
-- 
GitLab