This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Dockerfile
225 lines (210 loc) · 7.3 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# qBittorrent, OpenVPN and WireGuard, qbittorrentvpn
FROM debian:bullseye-slim
WORKDIR /opt
RUN usermod -u 99 nobody
# Make directories
RUN mkdir -p /downloads /config/qBittorrent /etc/openvpn /etc/qbittorrent
# Install boost
RUN apt update \
&& apt upgrade -y \
&& apt install -y --no-install-recommends \
curl \
ca-certificates \
g++ \
libxml2-utils \
&& BOOST_VERSION_DOT=$(curl -sX GET "https://www.boost.org/feed/news.rss" | xmllint --xpath '//rss/channel/item/title/text()' - | awk -F 'Version' '{print $2 FS}' - | sed -e 's/Version//g;s/\ //g' | xargs | awk 'NR==1{print $1}' -) \
&& BOOST_VERSION=$(echo ${BOOST_VERSION_DOT} | head -n 1 | sed -e 's/\./_/g') \
&& curl -o /opt/boost_${BOOST_VERSION}.tar.gz -L https://boostorg.jfrog.io/artifactory/main/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.gz \
&& tar -xzf /opt/boost_${BOOST_VERSION}.tar.gz -C /opt \
&& cd /opt/boost_${BOOST_VERSION} \
&& ./bootstrap.sh --prefix=/usr \
&& ./b2 --prefix=/usr install \
&& cd /opt \
&& rm -rf /opt/* \
&& apt -y purge \
curl \
ca-certificates \
g++ \
libxml2-utils \
&& apt-get clean \
&& apt --purge autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Install Ninja
RUN apt update \
&& apt upgrade -y \
&& apt install -y --no-install-recommends \
ca-certificates \
curl \
jq \
unzip \
&& NINJA_ASSETS=$(curl -sX GET "https://api.github.com/repos/ninja-build/ninja/releases" | jq '.[] | select(.prerelease==false) | .assets_url' | head -n 1 | tr -d '"') \
&& NINJA_DOWNLOAD_URL=$(curl -sX GET ${NINJA_ASSETS} | jq '.[] | select(.name | match("ninja-linux";"i")) .browser_download_url' | tr -d '"') \
&& curl -o /opt/ninja-linux.zip -L ${NINJA_DOWNLOAD_URL} \
&& unzip /opt/ninja-linux.zip -d /opt \
&& mv /opt/ninja /usr/local/bin/ninja \
&& chmod +x /usr/local/bin/ninja \
&& rm -rf /opt/* \
&& apt purge -y \
ca-certificates \
curl \
jq \
unzip \
&& apt-get clean \
&& apt --purge autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Install cmake
RUN apt update \
&& apt upgrade -y \
&& apt install -y --no-install-recommends \
ca-certificates \
curl \
jq \
&& CMAKE_ASSETS=$(curl -sX GET "https://api.github.com/repos/Kitware/CMake/releases" | jq '.[] | select(.prerelease==false) | .assets_url' | head -n 1 | tr -d '"') \
&& CMAKE_DOWNLOAD_URL=$(curl -sX GET ${CMAKE_ASSETS} | jq '.[] | select(.name | match("Linux-x86_64.sh";"i")) .browser_download_url' | tr -d '"') \
&& curl -o /opt/cmake.sh -L ${CMAKE_DOWNLOAD_URL} \
&& chmod +x /opt/cmake.sh \
&& /bin/bash /opt/cmake.sh --skip-license --prefix=/usr \
&& rm -rf /opt/* \
&& apt purge -y \
ca-certificates \
curl \
jq \
&& apt-get clean \
&& apt --purge autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Compile and install libtorrent-rasterbar
RUN apt update \
&& apt upgrade -y \
&& apt install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
jq \
libssl-dev \
&& LIBTORRENT_ASSETS=$(curl -sX GET "https://api.github.com/repos/arvidn/libtorrent/releases" | jq '.[] | select(.prerelease==false) | select(.target_commitish=="RC_1_2") | .assets_url' | head -n 1 | tr -d '"') \
&& LIBTORRENT_DOWNLOAD_URL=$(curl -sX GET ${LIBTORRENT_ASSETS} | jq '.[0] .browser_download_url' | tr -d '"') \
&& LIBTORRENT_NAME=$(curl -sX GET ${LIBTORRENT_ASSETS} | jq '.[0] .name' | tr -d '"') \
&& curl -o /opt/${LIBTORRENT_NAME} -L ${LIBTORRENT_DOWNLOAD_URL} \
&& tar -xzf /opt/${LIBTORRENT_NAME} \
&& rm /opt/${LIBTORRENT_NAME} \
&& cd /opt/libtorrent-rasterbar* \
&& cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_CXX_STANDARD=17 \
&& cmake --build build --parallel $(nproc) \
&& cmake --install build \
&& cd /opt \
&& rm -rf /opt/* \
&& apt purge -y \
build-essential \
ca-certificates \
curl \
jq \
libssl-dev \
&& apt-get clean \
&& apt --purge autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Compile and install qBittorrent
RUN apt update \
&& apt upgrade -y \
&& apt install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
jq \
libssl-dev \
pkg-config \
qtbase5-dev \
qttools5-dev \
zlib1g-dev \
&& QBITTORRENT_RELEASE=$(curl -sX GET "https://api.github.com/repos/qBittorrent/qBittorrent/tags" | jq '.[] | select(.name | index ("alpha") | not) | select(.name | index ("beta") | not) | select(.name | index ("rc") | not) | .name' | head -n 1 | tr -d '"') \
&& curl -o /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz -L "https://github.com/qbittorrent/qBittorrent/archive/${QBITTORRENT_RELEASE}.tar.gz" \
&& tar -xzf /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz \
&& rm /opt/qBittorrent-${QBITTORRENT_RELEASE}.tar.gz \
&& cd /opt/qBittorrent-${QBITTORRENT_RELEASE} \
&& cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DGUI=OFF -DCMAKE_CXX_STANDARD=17 \
&& cmake --build build --parallel $(nproc) \
&& cmake --install build \
&& cd /opt \
&& rm -rf /opt/* \
&& apt purge -y \
build-essential \
ca-certificates \
curl \
git \
jq \
libssl-dev \
pkg-config \
qtbase5-dev \
qttools5-dev \
zlib1g-dev \
&& apt-get clean \
&& apt --purge autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Install WireGuard and some other dependencies some of the scripts in the container rely on.
RUN echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable-wireguard.list \
&& printf 'Package: *\nPin: release a=unstable\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-unstable \
&& apt update \
&& apt install -y --no-install-recommends \
ca-certificates \
dos2unix \
inetutils-ping \
ipcalc \
iptables \
kmod \
libqt5network5 \
libqt5xml5 \
libqt5sql5 \
libssl1.1 \
moreutils \
net-tools \
openresolv \
openvpn \
procps \
wireguard-tools \
&& apt-get clean \
&& apt --purge autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Install (un)compressing tools like unrar, 7z, unzip and zip
RUN echo "deb http://deb.debian.org/debian/ bullseye non-free" > /etc/apt/sources.list.d/non-free-unrar.list \
&& printf 'Package: *\nPin: release a=non-free\nPin-Priority: 150\n' > /etc/apt/preferences.d/limit-non-free \
&& apt update \
&& apt -y upgrade \
&& apt -y install --no-install-recommends \
unrar \
p7zip-full \
unzip \
zip \
&& apt-get clean \
&& apt --purge autoremove -y \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Remove src_valid_mark from wg-quick
RUN sed -i /net\.ipv4\.conf\.all\.src_valid_mark/d `which wg-quick`
VOLUME /config /downloads
ADD openvpn/ /etc/openvpn/
ADD qbittorrent/ /etc/qbittorrent/
RUN chmod +x /etc/qbittorrent/*.sh /etc/qbittorrent/*.init /etc/openvpn/*.sh
EXPOSE 8080
EXPOSE 8999
EXPOSE 8999/udp
CMD ["/bin/bash", "/etc/openvpn/start.sh"]