# STAGE 1: Builder FROM debian:bookworm-slim AS builder MAINTAINER Wizardry and Steamworks (wizardry.steamworks@outlook.com) RUN apt-get update && apt-get install -y \ curl jq git cmake autoconf autogen automake bison build-essential \ flex libcppunit-dev libcurl4-openssl-dev libelf-dev libncurses-dev \ libsigc++-2.0-dev libssl-dev libtool zlib1g-dev pkg-config \ pkgconf libxmlrpc-c++8-dev WORKDIR /tmp/kitchen # Build libtorrent RUN curl -fLs https://github.com/rakshasa/rtorrent/releases/download/v0.9.8/libtorrent-0.13.8.tar.gz -o libtorrent.tar.gz && \ tar -xf libtorrent.tar.gz && cd libtorrent-0.13.8 && \ ./configure CXXFLAGS="-Os -march=native -flto" --disable-debug --enable-static --disable-shared && \ make -j$(nproc) && make install # Build rtorrent RUN curl -fLs https://github.com/rakshasa/rtorrent/releases/download/v0.9.8/rtorrent-0.9.8.tar.gz -o rtorrent.tar.gz && \ tar -xf rtorrent.tar.gz && cd rtorrent-0.9.8 && \ ./configure CXXFLAGS="-Os -march=native -flto" --with-xmlrpc-c --with-libcurl --disable-debug && \ make -j$(nproc) && make install # Download ttyd (Assuming aarch64 based on your original snippet) RUN curl -sL "https://api.github.com/repos/tsl0922/ttyd/releases/latest" | \ jq -r '.assets[] | select (.name | contains("aarch64")) | .browser_download_url' | \ xargs curl -sLo /usr/local/bin/ttyd && chmod +x /usr/local/bin/ttyd # STAGE 2: Runner FROM debian:bookworm-slim RUN apt-get update && apt-get install -y \ tini \ tmux \ nginx \ locales \ # Runtime dependencies for rtorrent/libtorrent libcurl4 \ libsigc++-2.0-0v5 \ libssl3 \ libxmlrpc-c++8v5 \ ncurses-base \ zlib1g \ libncursesw6 \ && apt-get clean && rm -rf /var/lib/apt/lists/* # UTF-8 Setup RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ locale-gen ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 # Copy binaries from builder COPY --from=builder /usr/local/bin/rtorrent /usr/local/bin/rtorrent COPY --from=builder /usr/local/bin/ttyd /usr/local/bin/ttyd # Copy libtorrent shared objects if not linked statically COPY --from=builder /usr/local/lib/libtorrent* /usr/local/lib/ RUN ldconfig # Structure & Volumes RUN mkdir -p /var/lib/rtorrent/downloads /var/lib/rtorrent/watch VOLUME ["/var/lib/rtorrent/downloads", "/var/lib/rtorrent/watch"] EXPOSE 62296 62298 7681 ADD rootfs / RUN chmod +x /usr/local/bin/run ENTRYPOINT [ "tini", "-g", "--" ] CMD [ "/usr/local/bin/run" ]