From a9147e0807ec458a205211fa3f73028169be7999 Mon Sep 17 00:00:00 2001 From: Christian Emmer <10749361+emmercm@users.noreply.github.com> Date: Fri, 10 Jul 2026 13:40:14 -0700 Subject: [PATCH 1/4] v2.1.0 --- .github/workflows/build-test-push.yml | 5 +- 2.1/.dockerignore | 11 +++++ 2.1/Dockerfile | 69 +++++++++++++++++++++++++++ 2.1/container-structure-test.yml | 43 +++++++++++++++++ README.md | 3 +- 5 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 2.1/.dockerignore create mode 100644 2.1/Dockerfile create mode 100644 2.1/container-structure-test.yml diff --git a/.github/workflows/build-test-push.yml b/.github/workflows/build-test-push.yml index c1e6fe6..7305987 100644 --- a/.github/workflows/build-test-push.yml +++ b/.github/workflows/build-test-push.yml @@ -38,6 +38,7 @@ jobs: - "1.2-py2" - "1.2-py3" - "2.0" + - "2.1" steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 - name: Run hadolint @@ -72,6 +73,7 @@ jobs: "1.2-py2": "1.2-py2/**" "1.2-py3": "1.2-py3/**" "2.0": "2.0/**" + "2.1": "2.1/**" - name: Select directories to build id: select @@ -87,7 +89,8 @@ jobs: {"directory": "1.1", "version": "1.1.14", "tags": "1.1 1.1-alpine"}, {"directory": "1.2-py2", "version": "1.2.11", "tags": ""}, {"directory": "1.2-py3", "version": "1.2.20", "tags": "1.2 1.2-alpine 1 1-alpine"}, - {"directory": "2.0", "version": "2.0.13", "tags": "2.0 2.0-alpine 2 2-alpine latest"} + {"directory": "2.0", "version": "2.0.13", "tags": "2.0 2.0-alpine"} + {"directory": "2.1", "version": "2.1.0", "tags": "2.1 2.1-alpine 2 2-alpine latest"} ] run: | SELECTED='[]' diff --git a/2.1/.dockerignore b/2.1/.dockerignore new file mode 100644 index 0000000..26d0248 --- /dev/null +++ b/2.1/.dockerignore @@ -0,0 +1,11 @@ +# Repo strucutre +.circleci/ +.git/ +LICENSE* +README* +*.json +*.yaml + +# Docker files +.dockerignore +Dockerfile diff --git a/2.1/Dockerfile b/2.1/Dockerfile new file mode 100644 index 0000000..b712a5f --- /dev/null +++ b/2.1/Dockerfile @@ -0,0 +1,69 @@ +# Instructions on building libtorrent: +# https://github.com/arvidn/libtorrent/blob/RC_2_0/docs/building.rst + +FROM alpine:3.24.0@sha256:a2d49ea686c2adfe3c992e47dc3b5e7fa6e6b5055609400dc2acaeb241c829f4 + +ARG VERSION=2.1.[0-9]\\+ + +SHELL ["/bin/ash", "-euo", "pipefail", "-c"] + +# Build libtorrent-rasterbar-dev +# hadolint ignore=DL3003,DL3018,SC2086 +RUN apk --update add --no-cache boost-python3 boost-system libgcc libstdc++ openssl python3 && \ + apk --update add --no-cache --virtual build-dependencies boost-build boost-dev cmake coreutils g++ gcc git jq py3-setuptools python3-dev openssl-dev samurai && \ + # Checkout from source + cd "$(mktemp -d)" && \ + git clone --branch "$( \ + wget -qO - https://api.github.com/repos/arvidn/libtorrent/tags?per_page=100 | jq -r '.[].name' | \ + awk '{print $1" "$1}' | \ + # Get rid of prefixes + sed 's/^libtorrent[^0-9]//i' | \ + sed 's/^v//i' | \ + # Use periods for major.minor.patch + sed 's/[^a-zA-Z0-9.]\([0-9]\+.* .*\)/.\1/g' | \ + sed 's/[^a-zA-Z0-9.]\([0-9]\+.* .*\)/.\1/g' | \ + # Make sure patch version exists + sed 's/^\([0-9]\+\.[0-9]\+\)\([^0-9.].\+\)/\1.0\2/' | \ + # Get the right version + sort --version-sort --key=1,1 | \ + grep "${VERSION}" | \ + tail -1 | \ + awk '{print $2}' \ + )" --depth 1 https://github.com/arvidn/libtorrent.git && \ + cd libtorrent && \ + git clean --force && \ + git submodule update --depth=1 --init --recursive && \ + # Build shared libraries + mkdir build-shared && \ + cd build-shared && \ + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + # https://github.com/arvidn/libtorrent/blob/RC_2_0/docs/building.rst#building-with-cmake + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_STANDARD=17 \ + -Dpython-bindings=ON \ + -Dpython-egg-info=ON \ + -Dpython-install-system-dir=ON \ + .. && \ + ninja "-j$(nproc)" && \ + ninja install && \ + cd .. && \ + # Build static libraries + mkdir build-static && \ + cd build-static && \ + cmake \ + -DCMAKE_INSTALL_PREFIX=/usr \ + # https://github.com/arvidn/libtorrent/blob/RC_2_0/docs/building.rst#building-with-cmake + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_STANDARD=17 \ + -DBUILD_SHARED_LIBS=OFF \ + .. && \ + ninja "-j$(nproc)" && \ + ninja install && \ + cd .. && \ + # Remove temp files + cd && \ + apk del --purge build-dependencies && \ + rm -rf /tmp/* diff --git a/2.1/container-structure-test.yml b/2.1/container-structure-test.yml new file mode 100644 index 0000000..b3bf29d --- /dev/null +++ b/2.1/container-structure-test.yml @@ -0,0 +1,43 @@ +schemaVersion: 2.0.0 + +fileExistenceTests: + # libtorrent files + - name: "libtorrent-rasterbar.a" + path: "/usr/lib/libtorrent-rasterbar.a" + shouldExist: true + permissions: "-rw-r--r--" + - name: "libtorrent-rasterbar.so" + path: "/usr/lib/libtorrent-rasterbar.so" + shouldExist: true + permissions: "Lrwxrwxrwx" + - name: "libtorrent-rasterbar.so.2.1" + path: "/usr/lib/libtorrent-rasterbar.so.2.1" + shouldExist: true + permissions: "Lrwxrwxrwx" + # CMake files (required for qBittorrent v5.0) + - name: "LibtorrentRasterbarConfig.cmake" + path: "/usr/lib/cmake/LibtorrentRasterbar/LibtorrentRasterbarConfig.cmake" + shouldExist: true + permissions: "-rw-r--r--" + +commandTests: + - name: "pkgconfig" + setup: [["apk", "add", "pkgconfig"]] + command: "pkg-config" + args: ["--list-all"] + expectedOutput: ["libtorrent-rasterbar"] + excludedError: [".+"] + exitCode: 0 + # Python tests (https://dev.deluge-torrent.org/wiki/Building/libtorrent#UbuntuDebian) + - name: "Python 3" + command: "python3" + args: ["-c", "import libtorrent; print(libtorrent.version)"] + expectedOutput: ["2.1"] + excludedError: [".+"] + exitCode: 0 + +# https://github.com/arvidn/libtorrent/issues/5865 +fileContentTests: + - name: "pkgconfig" + path: "/usr/lib/pkgconfig/libtorrent-rasterbar.pc" + expectedContents: ["Libs:.*-ltorrent-rasterbar"] diff --git a/README.md b/README.md index edb1fc4..ad85b7c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ Base images with libtorrent compiled. | Tags | Python Bindings | Size | |-|-|-| -| `2.0.13`, `2.0.13-alpine`, `2.0`, `2.0-alpine`, `2`, `2-alpine`, `latest` | v3 | [![](https://img.shields.io/docker/image-size/emmercm/libtorrent/2.0.13?logo=docker&logoColor=white&label=size)](https://hub.docker.com/r/emmercm/libtorrent/tags?name=2.0.13) | +| `2.1.0`, `2.1.0-alpine`, `2.1`, `2.1-alpine`, `2`, `2-alpine`, `latest` | v3 | [![](https://img.shields.io/docker/image-size/emmercm/libtorrent/2.1.0?logo=docker&logoColor=white&label=size)](https://hub.docker.com/r/emmercm/libtorrent/tags?name=2.1.0) | +| `2.0.13`, `2.0.13-alpine`, `2.0`, `2.0-alpine` | v3 | [![](https://img.shields.io/docker/image-size/emmercm/libtorrent/2.0.13?logo=docker&logoColor=white&label=size)](https://hub.docker.com/r/emmercm/libtorrent/tags?name=2.0.13) | | `1.2.20`, `1.2.20-alpine`, `1.2`, `1.2-alpine`, `1`, `1-alpine` | v3 | [![](https://img.shields.io/docker/image-size/emmercm/libtorrent/1.2.20?logo=docker&logoColor=white&label=size)](https://hub.docker.com/r/emmercm/libtorrent/tags?name=1.2.20) | | ⚠️ `1.2.11`, `1.2.11-alpine` | v2, v3 | [![](https://img.shields.io/docker/image-size/emmercm/libtorrent/1.2.11?logo=docker&logoColor=white&label=size)](https://hub.docker.com/r/emmercm/libtorrent/tags?name=1.2.11) | | ⚠️ `1.1.14`, `1.1.14-alpine`, `1.1`, `1.1-alpine` | v2, v3 | [![](https://img.shields.io/docker/image-size/emmercm/libtorrent/1.1.14?logo=docker&logoColor=white&label=size)](https://hub.docker.com/r/emmercm/libtorrent/tags?name=1.1.14) | From 284752b4f6fbfe0c56483d435002ef05d0941944 Mon Sep 17 00:00:00 2001 From: Christian Emmer <10749361+emmercm@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:28:17 -0700 Subject: [PATCH 2/4] Update --- .github/workflows/build-test-push.yml | 2 +- 2.1/Dockerfile | 14 +++++++++----- 2.1/container-structure-test.yml | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-test-push.yml b/.github/workflows/build-test-push.yml index 7305987..6d764fc 100644 --- a/.github/workflows/build-test-push.yml +++ b/.github/workflows/build-test-push.yml @@ -89,7 +89,7 @@ jobs: {"directory": "1.1", "version": "1.1.14", "tags": "1.1 1.1-alpine"}, {"directory": "1.2-py2", "version": "1.2.11", "tags": ""}, {"directory": "1.2-py3", "version": "1.2.20", "tags": "1.2 1.2-alpine 1 1-alpine"}, - {"directory": "2.0", "version": "2.0.13", "tags": "2.0 2.0-alpine"} + {"directory": "2.0", "version": "2.0.13", "tags": "2.0 2.0-alpine"}, {"directory": "2.1", "version": "2.1.0", "tags": "2.1 2.1-alpine 2 2-alpine latest"} ] run: | diff --git a/2.1/Dockerfile b/2.1/Dockerfile index b712a5f..9e3386b 100644 --- a/2.1/Dockerfile +++ b/2.1/Dockerfile @@ -1,5 +1,5 @@ # Instructions on building libtorrent: -# https://github.com/arvidn/libtorrent/blob/RC_2_0/docs/building.rst +# https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst FROM alpine:3.24.0@sha256:a2d49ea686c2adfe3c992e47dc3b5e7fa6e6b5055609400dc2acaeb241c829f4 @@ -9,8 +9,8 @@ SHELL ["/bin/ash", "-euo", "pipefail", "-c"] # Build libtorrent-rasterbar-dev # hadolint ignore=DL3003,DL3018,SC2086 -RUN apk --update add --no-cache boost-python3 boost-system libgcc libstdc++ openssl python3 && \ - apk --update add --no-cache --virtual build-dependencies boost-build boost-dev cmake coreutils g++ gcc git jq py3-setuptools python3-dev openssl-dev samurai && \ +RUN apk --update add --no-cache boost-python3 libgcc libstdc++ openssl python3 && \ + apk --update add --no-cache --virtual build-dependencies boost-dev cmake coreutils g++ gcc git jq py3-setuptools python3-dev openssl-dev samurai && \ # Checkout from source cd "$(mktemp -d)" && \ git clone --branch "$( \ @@ -27,6 +27,8 @@ RUN apk --update add --no-cache boost-python3 boost # Get the right version sort --version-sort --key=1,1 | \ grep "${VERSION}" | \ + # Ignore pre-releases (release candidates, betas, etc.) + grep -viE -- '-(rc|alpha|beta)' | \ tail -1 | \ awk '{print $2}' \ )" --depth 1 https://github.com/arvidn/libtorrent.git && \ @@ -38,10 +40,11 @@ RUN apk --update add --no-cache boost-python3 boost cd build-shared && \ cmake \ -DCMAKE_INSTALL_PREFIX=/usr \ - # https://github.com/arvidn/libtorrent/blob/RC_2_0/docs/building.rst#building-with-cmake + # https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst#building-with-cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ -Dpython-bindings=ON \ -Dpython-egg-info=ON \ -Dpython-install-system-dir=ON \ @@ -54,10 +57,11 @@ RUN apk --update add --no-cache boost-python3 boost cd build-static && \ cmake \ -DCMAKE_INSTALL_PREFIX=/usr \ - # https://github.com/arvidn/libtorrent/blob/RC_2_0/docs/building.rst#building-with-cmake + # https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst#building-with-cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ -DBUILD_SHARED_LIBS=OFF \ .. && \ ninja "-j$(nproc)" && \ diff --git a/2.1/container-structure-test.yml b/2.1/container-structure-test.yml index b3bf29d..69523e1 100644 --- a/2.1/container-structure-test.yml +++ b/2.1/container-structure-test.yml @@ -31,7 +31,7 @@ commandTests: # Python tests (https://dev.deluge-torrent.org/wiki/Building/libtorrent#UbuntuDebian) - name: "Python 3" command: "python3" - args: ["-c", "import libtorrent; print(libtorrent.version)"] + args: ["-c", "import libtorrent; print(libtorrent.__version__)"] expectedOutput: ["2.1"] excludedError: [".+"] exitCode: 0 From 06202ea64bacdcbac7d0e9e078ce78371f840e84 Mon Sep 17 00:00:00 2001 From: Christian Emmer <10749361+emmercm@users.noreply.github.com> Date: Fri, 10 Jul 2026 15:49:18 -0700 Subject: [PATCH 3/4] Logo --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad85b7c..93b6040 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![libtorrent logo](https://raw.githubusercontent.com/emmercm/docker-libtorrent/refs/heads/assets/libtorrent.png)](https://www.libtorrent.org/) + [![](https://badgen.net/badge/emmercm/libtorrent/blue?icon=docker)](https://hub.docker.com/r/emmercm/libtorrent) [![](https://badgen.net/docker/pulls/emmercm/libtorrent?icon=docker&label=pulls)](https://hub.docker.com/r/emmercm/libtorrent) [![](https://badgen.net/docker/stars/emmercm/libtorrent?icon=docker&label=stars)](https://hub.docker.com/r/emmercm/libtorrent) @@ -42,7 +44,7 @@ These images contain 4 main things: # Why full images? -As of writing the `libtorrent`/`libtorrent-dev` in the Alpine main repository is many years out of date. It can be time-consuming or difficult to compile libtorrent so this saves the end user time and headache. +As of writing, the `libtorrent`/`libtorrent-dev` in the Alpine main repository is many years out of date. It can be time-consuming or difficult to compile libtorrent so this saves the end user time and headache. # How to use these images From 478b860a8bc2ce54fdcf3d7844659bc054bb0ac9 Mon Sep 17 00:00:00 2001 From: Christian Emmer <10749361+emmercm@users.noreply.github.com> Date: Fri, 10 Jul 2026 17:27:59 -0700 Subject: [PATCH 4/4] C++20 --- 2.1/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2.1/Dockerfile b/2.1/Dockerfile index 9e3386b..c1f6b18 100644 --- a/2.1/Dockerfile +++ b/2.1/Dockerfile @@ -43,7 +43,7 @@ RUN apk --update add --no-cache boost-python3 libgc # https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst#building-with-cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ -Dpython-bindings=ON \ -Dpython-egg-info=ON \ @@ -60,7 +60,7 @@ RUN apk --update add --no-cache boost-python3 libgc # https://github.com/arvidn/libtorrent/blob/RC_2_1/docs/building.rst#building-with-cmake -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_CXX_STANDARD=20 \ -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ -DBUILD_SHARED_LIBS=OFF \ .. && \