# STAGE 1: Builder FROM alpine:3.19 AS builder LABEL maintainer="Wizardry and Steamworks (wizardry.steamworks@outlook.com)" # Install build dependencies for Alpine RUN apk add --no-cache \ curl jq git cmake autoconf automake libtool build-base \ linux-headers bison flex ncurses-dev openssl-dev \ curl-dev libsigc++-dev xmlrpc-c-dev zlib-dev pkgconf WORKDIR /tmp/kitchen # Build libtorrent (Fixes the "invalid tar magic" error with full URL and -xzf) RUN curl -fLs https://github.com/rakshasa/rtorrent/releases/download/v0.9.8/libtorrent-0.13.8.tar.gz -o libtorrent.tar.gz && \ tar -xzf 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 as per original request) 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 alpine:3.19 RUN apk add --no-cache \ tini \ tmux \ nginx \ bash \ ncurses \ libcurl \ libsigc++ \ libssl3 \ xmlrpc-c \ xmlrpc-c++ \ zlib \ tzdata # Alpine (musl-libc) is UTF-8 by default; no locale-gen/sed needed. ENV LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 # Copy binaries and libraries 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 --from=builder /usr/local/lib/libtorrent* /usr/local/lib/ # Update library cache for the custom libtorrent RUN ldconfig /usr/local/lib || true # 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 [ "/sbin/tini", "-g", "--" ] CMD [ "/usr/local/bin/run" ]