-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
115 lines (73 loc) · 3.39 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
FROM resin/rpi-raspbian:jessie
MAINTAINER vl0ms <i@vlms.me>
USER root
# For ffmpeg, which is required by the ruTorrent screenshots plugin
# This increases ~53 MB of the image size, remove it if you really don't need screenshots
#RUN echo "deb http://www.deb-multimedia.org jessie main" >> /etc/apt/sources.list && \
# apt-get update && apt-get install -q -y --force-yes --no-install-recommends \
# deb-multimedia-keyring \
# ffmpeg
# Install web server, packages and create ssl certificate
RUN apt-get update && apt-get install -q -y --no-install-recommends \
openssl \
ca-certificates \
apache2-utils \
libc-ares2 \
nginx \
php5-cli \
php5-fpm \
php5-geoip && \
update-rc.d nginx remove && \
openssl req -x509 -batch -nodes -newkey rsa:2048 -keyout /etc/ssl/private/aji.key -out /etc/ssl/private/aji.crt -subj /CN=AppleJobsInc && \
chmod 600 /etc/ssl/private/aji.key
# Install tools, and packages for rutorrent plugins
RUN apt-get update && \
apt-get install -y --force-yes unzip unrar-free mediainfo curl wget supervisor
# Make rtorrent from sources
ENV VER_LIBTORRENT 0.13.6
ENV VER_RTORRENT 0.9.6
ENV build_deps="automake build-essential ca-certificates libc-ares-dev libcppunit-dev libtool libssl-dev libxml2-dev libncurses5-dev pkg-config subversion wget"
WORKDIR /usr/local/src
# Compile rtorrent based on VER_RTORRENT and VER_LIBTORRENT
COPY rtorrent/compiletorrent.sh /usr/local/src/compiletorrent.sh
RUN /usr/local/src/compiletorrent.sh
# Download base for ruTorrent
COPY rutorrent/getrutorrent.sh /usr/local/src/getrutorrent.sh
RUN /usr/local/src/getrutorrent.sh
# rtorrent startup
COPY rtorrent/runrtorrent.sh /usr/local/src/runrtorrent.sh
# rtorrent and ruTorrent base configurations
COPY rtorrent/config/.rtorrent.rc /usr/local/src/.rtorrent.rc
COPY rutorrent/config/config.php /usr/local/src/config.php
# Base ruTorrent startup with NGInx in no-daemon mode
COPY rutorrent/runrutorrent.sh /usr/local/src/runrutorrent.sh
# Base configuration for NGinx
COPY nginx/config/rutorrent.conf /etc/nginx/sites-enabled/default
COPY nginx/config/rutorrent-ssl.conf /etc/nginx/sites-enabled/tls
COPY nginx/config/nginx.conf /etc/nginx/nginx.conf
# Configure rtorrent user
RUN useradd -d /home/rtorrent -m -s /bin/bash rtorrent
RUN chown -R rtorrent:rtorrent /home/rtorrent
# Geo Codes
RUN curl -LOks http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz && gunzip GeoLiteCity.dat.gz && \
mkdir /usr/share/GeoIP && mv GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
# Cleanup repositories
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get purge -y --auto-remove ${build_deps} && apt-get autoremove -y
# Configure supervisor
ADD supervisord/supervisord.conf /etc/supervisor/supervisord.conf
# Change 'toxic' favicon
COPY rutorrent/index.html /usr/share/nginx/html/rutorrent/index.html
COPY rutorrent/favicon.ico /usr/share/nginx/html/rutorrent/images/favicon.ico
# Ports
EXPOSE 80
EXPOSE 443
EXPOSE 49160
EXPOSE 49161
# Volume for data and rtorrent configuration
VOLUME /rtorrent
# Change the default login/password of ruTorrent
ENV WEB_USER=user
ENV WEB_PASS=password
RUN PASSWORD="$WEB_PASS";SALT="$(openssl rand -base64 3)";SHA1=$(printf "$PASSWORD$SALT" | openssl dgst -binary -sha1 | sed 's#$#'"$SALT"'#' | base64);printf "$WEB_USER:{SSHA}$SHA1\n" >> /usr/share/nginx/html/rutorrent/.htpasswd
CMD ["supervisord"]