1- ARG LIBTORRENT_VERSION=1.2.14
2- ARG QBITTORRENT_VERSION=4.3.8
1+ ARG QBITTORRENT_VERSION=4.4.1
2+ ARG LIBTORRENT_VERSION=2.0.5
3+ ARG XX_VERSION=1.1.0
34
4- FROM crazymax/yasu:latest AS yasu
5- FROM alpine:3.15 AS builder
6-
7- RUN apk add --update --no-cache \
8- autoconf \
9- automake \
10- binutils \
11- boost-dev \
12- build-base \
13- cppunit-dev \
14- git \
15- libtool \
16- linux-headers \
17- ncurses-dev \
18- openssl-dev \
19- zlib-dev \
20- && rm -rf /tmp/*
5+ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
6+ FROM --platform=$BUILDPLATFORM alpine:3.15 AS base
7+ COPY --from=xx / /
8+ RUN apk --update --no-cache add git
219
10+ FROM base AS libtorrent-src
2211ARG LIBTORRENT_VERSION
23- RUN cd /tmp \
24- && git clone --branch v${LIBTORRENT_VERSION} --recurse-submodules https://github.com/arvidn/libtorrent.git \
25- && cd libtorrent \
26- && ./autotool.sh \
27- && ./configure CXXFLAGS="-std=c++14" --with-libiconv \
28- && make -j$(nproc) \
29- && make install-strip \
30- && ls -al /usr/local/lib/
31-
32- RUN apk add --update --no-cache \
33- qt5-qtbase \
34- qt5-qttools-dev \
35- && rm -rf /tmp/*
12+ WORKDIR /src
13+ RUN git clone --branch v${LIBTORRENT_VERSION} --recurse-submodules https://github.com/arvidn/libtorrent.git .
3614
15+ FROM base AS qbittorrent-src
3716ARG QBITTORRENT_VERSION
38- RUN cd /tmp \
39- && git clone --branch release-${QBITTORRENT_VERSION} https://github.com/qbittorrent/qBittorrent.git \
40- && cd qBittorrent \
41- && ./configure --disable-gui \
42- && make -j$(nproc) \
43- && make install \
44- && ls -al /usr/local/bin/ \
45- && qbittorrent-nox --help
17+ WORKDIR /src
18+ RUN git clone --branch release-${QBITTORRENT_VERSION} --shallow-submodules --recurse-submodules https://github.com/qbittorrent/qBittorrent.git .
19+
20+ FROM base AS build
21+ RUN apk --update --no-cache add binutils clang cmake libtool linux-headers ninja perl pkgconf tree
4622
23+ COPY --from=libtorrent-src /src /src/libtorrent
24+ WORKDIR /src/libtorrent
25+ ARG TARGETPLATFORM
26+ RUN xx-apk --no-cache --no-scripts add gcc g++ boost-dev cppunit-dev ncurses-dev openssl-dev python3-dev py3-numpy-dev zlib-dev
27+ RUN export QEMU_LD_PREFIX=$(xx-info sysroot) \
28+ && cmake -Wno-dev -G Ninja -B build $(xx-clang --print-cmake-defines) \
29+ -DCMAKE_SYSROOT="$(xx-info sysroot)" \
30+ -DCMAKE_CXX_FLAGS="-w -s" \
31+ -DCMAKE_BUILD_TYPE="Release" \
32+ -DCMAKE_CXX_STANDARD=17 \
33+ -DCMAKE_INSTALL_LIBDIR="lib" \
34+ -DCMAKE_INSTALL_PREFIX="$(xx-info sysroot)usr/local" \
35+ && cmake --build build --verbose \
36+ && cmake --install build
37+
38+ COPY --from=qbittorrent-src /src /src/qbittorrent
39+ WORKDIR /src/qbittorrent
40+ RUN xx-apk --no-cache --no-scripts add icu-dev libexecinfo-dev qt5-qtbase-dev qt5-qttools-dev qt5-qtsvg-dev
41+ RUN export QEMU_LD_PREFIX=$(xx-info sysroot) \
42+ && cmake -Wno-dev -G Ninja -B build $(xx-clang --print-cmake-defines) \
43+ -DGUI=OFF \
44+ -DCMAKE_SYSROOT="$(xx-info sysroot)" \
45+ -DCMAKE_CXX_FLAGS="-w -s" \
46+ -DCMAKE_BUILD_TYPE="Release" \
47+ -DCMAKE_CXX_STANDARD=17 \
48+ -DCMAKE_CXX_STANDARD_LIBRARIES="$(xx-info sysroot)usr/lib/libexecinfo.so.1" \
49+ -DCMAKE_INSTALL_PREFIX="$(xx-info sysroot)usr/local" \
50+ && cmake --build build --verbose \
51+ && cmake --install build
52+
53+ RUN mkdir -p /out/usr/local/bin /out/usr/local/lib \
54+ && cp $(xx-info sysroot)usr/local/lib/libtorrent-rasterbar.so* /out/usr/local/lib/ \
55+ && cp $(xx-info sysroot)usr/local/bin/qbittorrent-nox /out/usr/local/bin/
56+
57+ FROM crazymax/yasu:latest AS yasu
4758FROM alpine:3.15
4859
4960COPY --from=yasu / /
50- COPY --from=builder /usr/local/lib/libtorrent-rasterbar.so.10.0.0 /usr/lib/libtorrent-rasterbar.so.10
51- COPY --from=builder /usr/local/bin/qbittorrent-nox /usr/bin/qbittorrent-nox
61+ COPY --from=build /out /
5262
5363RUN apk --update --no-cache add \
5464 bind-tools \
5565 curl \
66+ icu \
67+ libexecinfo \
5668 openssl \
5769 qt5-qtbase \
70+ qt5-qtsvg \
5871 shadow \
5972 tzdata \
6073 unzip \
@@ -72,14 +85,15 @@ COPY entrypoint.sh /entrypoint.sh
7285RUN chmod a+x /entrypoint.sh \
7386 && addgroup -g ${PGID} qbittorrent \
7487 && adduser -D -h ${QBITTORRENT_HOME} -u ${PUID} -G qbittorrent -s /bin/sh qbittorrent \
75- && qbittorrent-nox --version
88+ && qbittorrent-nox --version \
89+ && uname -a
7690
7791EXPOSE 6881 6881/udp ${WEBUI_PORT}
7892WORKDIR /data
7993VOLUME [ "/data" ]
8094
8195ENTRYPOINT [ "/entrypoint.sh" ]
82- CMD [ "/usr/bin/qbittorrent-nox" ]
96+ CMD [ "/usr/local/ bin/qbittorrent-nox" ]
8397
8498HEALTHCHECK --interval=10s --timeout=10s --start-period=20s \
8599 CMD curl --fail http://127.0.0.1:${WEBUI_PORT}/api/v2/app/version || exit 1
0 commit comments