Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build-test-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- "1.2-py2"
- "1.2-py3"
- "2.0"
- "2.1"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Run hadolint
Expand Down Expand Up @@ -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
Expand All @@ -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='[]'
Expand Down
11 changes: 11 additions & 0 deletions 2.1/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Repo strucutre
.circleci/
.git/
LICENSE*
README*
*.json
*.yaml

# Docker files
.dockerignore
Dockerfile
73 changes: 73 additions & 0 deletions 2.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Instructions on building libtorrent:
# https://github.com/arvidn/libtorrent/blob/RC_2_1/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 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 "$( \
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}" | \
# 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 && \
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_1/docs/building.rst#building-with-cmake
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-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_1/docs/building.rst#building-with-cmake
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
-DBUILD_SHARED_LIBS=OFF \
.. && \
ninja "-j$(nproc)" && \
ninja install && \
cd .. && \
# Remove temp files
cd && \
apk del --purge build-dependencies && \
rm -rf /tmp/*
43 changes: 43 additions & 0 deletions 2.1/container-structure-test.yml
Original file line number Diff line number Diff line change
@@ -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"]
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -11,7 +13,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) |
| <span title="Unmaintained">⚠️</span> `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) |
| <span title="Unmaintained">⚠️</span> `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) |
Expand Down Expand Up @@ -41,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

Expand Down