-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
60 lines (55 loc) 路 2.67 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Instructions on building libtorrent:
# https://github.com/qbittorrent/qBittorrent/wiki/Compiling-qBittorrent-on-Debian-and-Ubuntu#libtorrent
# https://discourse.osmc.tv/t/howto-update-compile-qbittorrent-nox/19726/3
# https://git.alpinelinux.org/aports/tree/testing/libtorrent-rasterbar/APKBUILD
FROM alpine:3.11.13@sha256:bcae378eacedab83da66079d9366c8f5df542d7ed9ab23bf487e3e1a8481375d
ARG VERSION=1.2.[0-9]+
COPY 5026.patch /
SHELL ["/bin/ash", "-euo", "pipefail", "-c"]
# Build libtorrent-rasterbar-dev
# hadolint ignore=DL3003,DL3018,SC2169,SC3060
RUN apk --update add --no-cache boost-system libgcc libstdc++ openssl && \
apk --update add --no-cache --virtual build-dependencies autoconf automake boost-dev coreutils file g++ gcc git jq libtool make openssl-dev && \
# 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 && \
git apply /5026.patch && rm /5026.patch && \
# Run autoconf/automake, configure, and make
./autotool.sh && \
for PYTHON_VERSION in $(seq 2 3); do \
(apk --update add --no-cache "python${PYTHON_VERSION}" "boost-python${PYTHON_VERSION}" && \
apk --update add --no-cache --virtual python-dependencies "python${PYTHON_VERSION}-dev" && \
./configure \
--prefix=/usr \
--with-libiconv \
--enable-python-binding \
--with-boost-python="$(find /usr/lib -maxdepth 1 -name "libboost_python${PYTHON_VERSION/2/}*.so*" | sort | head -1 | sed 's/.*.\/lib\(.*\)\.so.*/\1/')" \
--with-cxx-standard=14 \
PYTHON="$(which "python${PYTHON_VERSION}")" && \
make "-j$(nproc)" && \
make install-strip && \
apk del --purge python-dependencies) || exit 1; \
done && \
# Remove temp files
cd && \
apk del --purge build-dependencies && \
rm -rf /tmp/*