2018-02-03 01:39:30 -05:00
# qBittorrent and OpenVPN
2014-11-09 16:23:18 +01:00
#
2018-02-06 01:35:55 -05:00
# Version 1.8
2014-11-09 16:23:18 +01:00
2021-03-22 23:40:02 -04:00
FROM alpine:edge
2018-02-02 02:54:32 -05:00
MAINTAINER MarkusMcNugen
2014-11-09 16:23:18 +01:00
2018-02-02 03:56:16 -05:00
VOLUME /downloads
2015-05-24 19:05:05 +02:00
VOLUME /config
2014-11-09 16:23:18 +01:00
2021-03-22 21:21:08 -04:00
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories
2021-03-22 22:31:02 -04:00
RUN apk upgrade --no-cache
RUN apk add --no-cache --upgrade coreutils
RUN apk add --no-cache --upgrade bash
RUN apk add --no-cache --upgrade openvpn
RUN apk add --no-cache --upgrade openssl
RUN apk add --no-cache --upgrade iptables
RUN apk add --no-cache --upgrade shadow
RUN apk add --no-cache --upgrade boost-system
RUN apk add --no-cache --upgrade boost-thread
RUN apk add --no-cache --upgrade ca-certificates
RUN apk add --no-cache --upgrade unrar
RUN apk add --no-cache --upgrade findutils
RUN apk add --no-cache --upgrade perl
RUN apk add --no-cache --upgrade gawk
RUN apk add --no-cache --upgrade pacman
RUN apk add --no-cache --upgrade net-tools
2021-03-23 00:21:15 -04:00
RUN apk add --no-cache --upgrade tar
2021-03-22 21:37:20 -04:00
RUN update-ca-certificates
2018-02-12 00:53:44 -05:00
2018-02-11 18:03:56 -05:00
RUN usermod -u 99 nobody
2018-02-11 18:00:30 -05:00
2018-02-11 20:43:13 -05:00
# copy patches
COPY patches/ /tmp/patches
2018-02-11 18:00:30 -05:00
RUN buildDeps = " \
2018-02-11 19:54:06 -05:00
automake \
autoconf \
2018-02-11 20:02:04 -05:00
boost-dev \
2021-03-22 23:41:43 -04:00
clang \
2018-02-11 18:00:30 -05:00
curl \
2018-02-11 20:14:41 -05:00
cmake \
file \
2018-02-11 18:00:30 -05:00
g++ \
2018-02-11 20:40:54 -05:00
git \
2018-02-11 20:14:41 -05:00
geoip-dev \
2018-02-11 18:00:30 -05:00
gnutls-dev \
2018-02-11 19:57:21 -05:00
libtool \
2018-02-11 18:00:30 -05:00
linux-headers \
linux-pam-dev \
make \
2018-02-11 20:14:41 -05:00
qt5-qttools-dev \
2018-02-11 19:22:00 -05:00
qt5-qtbase-dev \
2018-02-11 18:00:30 -05:00
readline-dev \
xz \
" ; \
set -x \
2021-03-22 21:13:42 -04:00
&& apk add --update --virtual .build-deps $buildDeps
2021-03-23 01:48:57 -04:00
RUN 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!.*/!!' ) \
2021-03-23 02:14:05 -04:00
&& curl -SL " https://github.com/arvidn/libtorrent/archive/ $LIBTOR_VERSION .tar.gz " -o tibtor.tar.gz \
2021-03-23 01:48:57 -04:00
&& mkdir -p /usr/src/libtorrent \
2021-03-23 02:14:05 -04:00
&& tar -xf "tibtor.tar.gz" -C /usr/src/libtorrent --strip-components= 1 \
&& rm "tibtor.tar.gz"
2021-03-23 00:30:05 -04:00
WORKDIR /usr/src/libtorrent/
2021-03-23 00:05:59 -04:00
RUN ./autotool.sh
RUN export LDFLAGS = -L/opt/local/lib
RUN export CXXFLAGS = -I/opt/local/include
2021-03-23 03:38:48 -04:00
RUN ./configure --disable-debug --enable-encryption --prefix= /usr --disable-dependency-tracking
RUN make
RUN make install
2021-03-23 00:05:59 -04:00
RUN 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!.*/!!' )
2021-03-23 00:52:40 -04:00
RUN curl -SL " https://github.com/qbittorrent/qBittorrent/archive/ $QBIT_VERSION .tar.gz " -o qbittorrent.tar.gz
2021-03-23 00:05:59 -04:00
RUN mkdir -p /usr/src/qbittorrent
2021-03-23 03:41:54 -04:00
RUN tar -xf qbittorrent.tar.gz -C /usr/src/qbittorrent --strip-components= 1
2021-03-23 00:05:59 -04:00
RUN rm qbittorrent.tar.gz*
2021-03-23 00:30:05 -04:00
WORKDIR /usr/src/qbittorrent/src/app
2021-03-23 00:05:59 -04:00
RUN patch -i /tmp/patches/main.patch
2021-03-23 00:30:05 -04:00
WORKDIR /usr/src/qbittorrent/
2021-03-23 03:38:48 -04:00
RUN ./configure --disable-gui --prefix= /usr
RUN make
RUN make install
2021-03-23 00:30:05 -04:00
WORKDIR /
2021-03-23 00:05:59 -04:00
RUN rm -rf /usr/src/libtorrent
RUN rm -rf /usr/src/qbittorrent
2021-03-22 21:13:42 -04:00
RUN runDeps = " $( \
2018-02-11 18:02:53 -05:00
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-11 20:44:31 -05:00
&& rm -rf /var/cache/apk/* \
2018-02-11 20:43:13 -05:00
&& rm -rf /tmp/*
2014-11-16 14:19:56 +01:00
2014-11-09 19:52:52 +01:00
# Add configuration and scripts
2015-08-07 23:07:55 +02:00
ADD openvpn/ /etc/openvpn/
2018-02-02 19:56:08 -05:00
ADD qbittorrent/ /etc/qbittorrent/
2014-11-09 16:23:18 +01:00
2018-02-03 22:45:22 -05:00
RUN chmod +x /etc/qbittorrent/*.sh /etc/qbittorrent/*.init /etc/openvpn/*.sh
2018-02-03 00:26:50 -05:00
2018-02-02 21:55:43 -05:00
# Expose ports and run
2018-02-02 02:54:32 -05:00
EXPOSE 8080
2018-02-02 21:55:43 -05:00
EXPOSE 8999
EXPOSE 8999/udp
2018-02-03 00:37:37 -05:00
CMD [ "/bin/bash" , "/etc/openvpn/start.sh" ]