forked from schmas/docker-openvpn-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (52 loc) · 1.94 KB
/
Dockerfile
File metadata and controls
65 lines (52 loc) · 1.94 KB
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
# OpenVPN Client
#
# based on https://github.com/haugene/docker-transmission-openvpn
#
# Version 0.0.1
#
# See
# https://github.com/phusion/baseimage-docker/blob/master/Changelog.md
# for a list of version numbers.
FROM phusion/baseimage:latest
MAINTAINER Diego Schmidt <dceschmidt@gmail.com>
# 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"]
# Update packages and install software
RUN apt-get update \
&& apt-get install -y openvpn inetutils-traceroute inetutils-ping wget curl \
&& curl -L https://github.com/jwilder/dockerize/releases/download/v0.2.0/dockerize-linux-amd64-v0.2.0.tar.gz | tar -C /usr/local/bin -xzv \
&& rm -rfv dockerize-linux-amd64-v0.2.0.tar.gz \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
# Enabling SSH
RUN rm -f /etc/service/sshd/down
# Enabling the insecure key permanently
RUN /usr/sbin/enable_insecure_key
# Expose port and run
EXPOSE 22
# Volumes
VOLUME /config
# 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