forked from trick77/dockerflix
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
73 lines (58 loc) · 2.15 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
# dockerflix + openvpn
#
# based on:
# * Dockerflix: https://github.com/trick77/dockerflix
# * OpenVPN Client: https://github.com/schmas/docker-openvpn-client
#
FROM phusion/baseimage:0.9.17
MAINTAINER derrod <[email protected]>
# Evironment variables
ENV DEBIAN_FRONTEND=noninteractive \
OPENVPN_USERNAME=**None** \
OPENVPN_PASSWORD=**None** \
OPENVPN_PROVIDER=**None**
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
RUN apt-get -qq update
RUN apt-get -y install python-software-properties \
&& add-apt-repository ppa:dlundquist/sniproxy \
&& apt-get update && apt-get -y install sniproxy \
&& apt-get install -y openvpn inetutils-traceroute inetutils-ping wget curl \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Create runit services
RUN mkdir /etc/sniproxy
# ADD ./config/dockerflix-sniproxy.conf /etc/sniproxy/sniproxy.conf
RUN mkdir /etc/service/sniproxy
ADD ./config/run_sniproxy /etc/service/sniproxy/run
RUN chmod +x /etc/service/sniproxy/run
EXPOSE 22 80 443
# Enabling SSH
RUN rm -f /etc/service/sshd/down
# Enabling the insecure key permanently
RUN /usr/sbin/enable_insecure_key
# Volumes
VOLUME /config
VOLUME /etc/sniproxy
VOLUME /var/log/sniproxy
# Adding utils scripts to bin
ADD bin/ /usr/local/bin/
RUN chmod +x /usr/local/bin/*
# Add configuration and scripts
ADD openvpn /etc/openvpn
RUN chmod +x /etc/openvpn/bin/* \
&& mkdir -p /etc/openvpn/up \
&& mkdir -p /etc/openvpn/down \
&& ln -s /usr/local/bin/ssh-restart /etc/openvpn/up/00-ssh-restart \
&& ln -s /usr/local/bin/my-public-ip-info /etc/openvpn/up/01-my-public-ip-info
# Running scripts during container startup
RUN mkdir -p /etc/my_init.d \
&& ln -s /etc/openvpn/bin/openvpn-setup.sh /etc/my_init.d/openvpn-setup.sh \
&& chmod +x /etc/my_init.d/*
# Add to runit
RUN mkdir /etc/service/openvpn \
&& ln -s /etc/openvpn/bin/openvpn-run.sh /etc/service/openvpn/run \
&& ln -s /etc/openvpn/bin/openvpn-finish.sh /etc/service/openvpn/finish \
&& chmod +x /etc/service/openvpn/run \
&& chmod +x /etc/service/openvpn/finish
# Final cleanup
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*