docker-qBittorrentvpn/Dockerfile

91 lines
2.9 KiB
Docker
Raw Normal View History

2018-02-03 06:39:30 +00:00
# qBittorrent and OpenVPN
#
2018-02-06 06:35:55 +00:00
# Version 1.8
2018-02-11 23:00:30 +00:00
FROM alpine:3.7
2018-02-02 07:54:32 +00:00
MAINTAINER MarkusMcNugen
2018-02-02 08:56:16 +00:00
VOLUME /downloads
VOLUME /config
2018-02-11 23:00:30 +00:00
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories \
&& echo "http://dl-4.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \
2018-02-12 04:25:12 +00:00
&& apk add --update bash openvpn iptables shadow boost-system boost-thread ca-certificates unrar findutils perl
2018-02-11 23:03:56 +00:00
RUN usermod -u 99 nobody
2018-02-11 23:00:30 +00:00
2018-02-12 01:43:13 +00:00
# copy patches
COPY patches/ /tmp/patches
2018-02-11 23:00:30 +00:00
RUN buildDeps=" \
2018-02-12 00:54:06 +00:00
automake \
autoconf \
2018-02-12 01:02:04 +00:00
boost-dev \
2018-02-11 23:00:30 +00:00
curl \
2018-02-12 01:14:41 +00:00
cmake \
file \
2018-02-11 23:00:30 +00:00
g++ \
2018-02-12 01:40:54 +00:00
git \
2018-02-12 01:14:41 +00:00
geoip-dev \
2018-02-11 23:00:30 +00:00
gnutls-dev \
2018-02-12 00:57:21 +00:00
libtool \
2018-02-11 23:00:30 +00:00
linux-headers \
linux-pam-dev \
make \
2018-02-12 01:14:41 +00:00
qt5-qttools-dev \
2018-02-12 00:22:00 +00:00
qt5-qtbase-dev \
2018-02-11 23:00:30 +00:00
readline-dev \
tar \
xz \
"; \
set -x \
2018-02-11 23:02:53 +00:00
&& apk add --update --virtual .build-deps $buildDeps \
&& export LIBTOR_VERSION=$(curl --silent "https://github.com/arvidn/libtorrent/tags" 2>&1 | grep -m 1 'libtorrent-' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~' | sed -n 's/.*href="\([^"]*\).*/\1/p' | sed 's!.*/!!') \
&& curl -L "https://github.com/arvidn/libtorrent/archive/$LIBTOR_VERSION.tar.gz" -o libtor.tar.gz \
2018-02-11 23:00:30 +00:00
&& mkdir -p /usr/src/libtorrent \
2018-02-11 23:02:53 +00:00
&& tar -xzf libtor.tar.gz -C /usr/src/libtorrent --strip-components=1 \
2018-02-11 23:00:30 +00:00
&& rm libtor.tar.gz* \
2018-02-11 23:02:53 +00:00
&& cd /usr/src/libtorrent/ \
2018-02-12 00:56:08 +00:00
&& ./autotool.sh \
2018-02-12 00:54:06 +00:00
&& export LDFLAGS=-L/opt/local/lib \
&& export CXXFLAGS=-I/opt/local/include \
2018-02-12 01:40:54 +00:00
&& ./configure --disable-debug --enable-encryption --prefix=/usr \
2018-02-12 01:49:35 +00:00
&& make -j$(nproc) \
2018-02-12 02:43:07 +00:00
&& make install \
&& QBIT_VERSION=$(curl --silent "https://github.com/qbittorrent/qBittorrent/tags" 2>&1 | grep -m 1 'release-' | sed -e 's~^[ \t]*~~;s~[ \t]*$~~' | sed -n 's/.*href="\([^"]*\).*/\1/p' | sed 's!.*/!!') \
2018-02-12 02:07:22 +00:00
&& curl -L "https://github.com/qbittorrent/qBittorrent/archive/$QBIT_VERSION.tar.gz" -o qbittorrent.tar.gz \
&& mkdir -p /usr/src/qbittorrent \
&& tar -xzf qbittorrent.tar.gz -C /usr/src/qbittorrent --strip-components=1 \
&& rm qbittorrent.tar.gz* \
2018-02-12 03:19:03 +00:00
&& cd /usr/src/qbittorrent/src/app \
2018-02-12 03:28:40 +00:00
&& patch -i /tmp/patches/main.patch \
2018-02-12 01:44:31 +00:00
&& cd /usr/src/qbittorrent/ \
2018-02-12 01:40:54 +00:00
&& ./configure --disable-gui --prefix=/usr \
2018-02-11 23:02:53 +00:00
&& make -j$(nproc) \
2018-02-12 01:40:54 +00:00
&& make install \
2018-02-11 23:00:30 +00:00
&& cd / \
2018-02-11 23:02:53 +00:00
&& rm -rf /usr/src/libtorrent \
2018-02-11 23:00:30 +00:00
&& rm -rf /usr/src/qbittorrent \
2018-02-11 23:02:53 +00:00
&& runDeps="$( \
scanelf --needed --nobanner /usr/local/bin/qbittorrent-nox \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| xargs -r apk info --installed \
| sort -u \
)" \
&& apk add --virtual .run-deps $runDeps gnutls-utils iptables \
&& apk del .build-deps \
2018-02-12 01:44:31 +00:00
&& rm -rf /var/cache/apk/* \
2018-02-12 01:43:13 +00:00
&& rm -rf /tmp/*
# Add configuration and scripts
ADD openvpn/ /etc/openvpn/
ADD qbittorrent/ /etc/qbittorrent/
2018-02-04 03:45:22 +00:00
RUN chmod +x /etc/qbittorrent/*.sh /etc/qbittorrent/*.init /etc/openvpn/*.sh
2018-02-03 05:26:50 +00:00
2018-02-03 02:55:43 +00:00
# Expose ports and run
2018-02-02 07:54:32 +00:00
EXPOSE 8080
2018-02-03 02:55:43 +00:00
EXPOSE 8999
EXPOSE 8999/udp
2018-02-03 05:37:37 +00:00
CMD ["/bin/bash", "/etc/openvpn/start.sh"]