forked from Trigus42/alpine-qbittorrentvpn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.compile
99 lines (86 loc) · 2.97 KB
/
Dockerfile.compile
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
FROM alpine:3.14 as builder
ARG QBITTORRENT_VERSION
ARG BUILD_DATE
WORKDIR /root/
# Install build dependencies
RUN \
apk update; \
apk add --no-cache --virtual .build-deps autoconf automake build-base cmake curl git libtool linux-headers perl pkgconf python3 python3-dev re2c tar \
icu-dev libexecinfo-dev openssl-dev qt5-qtbase-dev qt5-qttools-dev zlib-dev qt5-qtsvg-dev ninja boost-dev; \
exit 0
# Compile Libtorrent
RUN \
git clone --shallow-submodules --recurse-submodules https://github.com/arvidn/libtorrent.git libtorrent && cd libtorrent; \
git checkout "$(git tag -l --sort=-v:refname "v2*" | head -n 1)"; \
cmake -Wno-dev -G Ninja -B build \
-D CMAKE_BUILD_TYPE="Release" \
-D CMAKE_CXX_STANDARD=17 \
-D CMAKE_INSTALL_LIBDIR="lib" \
-D CMAKE_INSTALL_PREFIX="/usr/local"; \
cmake --build build; \
cmake --install build
# Compile qBittorrent
RUN \
git clone --shallow-submodules --recurse-submodules https://github.com/qbittorrent/qBittorrent.git qbittorrent && cd qbittorrent; \
git checkout release-$QBITTORRENT_VERSION; \
cmake -Wno-dev -G Ninja -B build \
-D CMAKE_BUILD_TYPE="release" \
-D CMAKE_CXX_STANDARD=17 \
-D CMAKE_CXX_STANDARD_LIBRARIES="/usr/lib/libexecinfo.so" \
-D CMAKE_INSTALL_PREFIX="/usr/local" \
-D GUI=OFF; \
cmake --build build
FROM alpine:3.14
# You can find the available release tags at https://github.com/just-containers/s6-overlay/releases
ARG S6_OVERLAY_VERSION="v2.2.0.3"
# Exit if one of the cont-init.d scripts fails
ENV S6_BEHAVIOUR_IF_STAGE2_FAILS=2
RUN \
# Mount files from build stage
--mount=type=bind,from=builder,src=/root,dst=/mnt/build/ \
# Copy build files from ro mount
cp -r /mnt/build/libtorrent /root/; \
cp -r /mnt/build/qbittorrent /root/; \
# Add cmake
apk add --no-cache cmake; \
# Install libtorrent
cd /root/libtorrent; \
cmake --install build; \
# Install qBittorrent
cd /root/qbittorrent; \
cmake --install build; \
# Remove cmake
apk del --no-cache --purge cmake; \
# Remove build files
rm -r /root/libtorrent /root/qbittorrent
COPY ./build/s6-overlay-arch /tmp/s6-overlay-arch
COPY rootfs /
RUN \
# Install tools
apk update; \
apk add --no-cache \
bash \
dos2unix \
grep \
ipcalc \
iptables \
iputils \
libexecinfo \
net-tools \
openresolv \
openssl \
openvpn \
qt5-qtbase \
tzdata \
wget \
wireguard-tools; \
# Install s6-overlay
chmod +x /tmp/s6-overlay-arch; \
wget https://github.com/just-containers/s6-overlay/releases/download/${S6_OVERLAY_VERSION}/s6-overlay-$(/tmp/s6-overlay-arch).tar.gz -O /tmp/s6_overlay.tar.gz; \
tar -xf /tmp/s6_overlay.tar.gz -C /; \
rm -r /tmp/*; \
# Set exec permissions
chmod +x -R /helper/ /etc/cont-init.d/ /etc/services.d/
VOLUME /config /downloads
EXPOSE 8080
CMD ["/init"]