-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
90 lines (76 loc) · 2.25 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
FROM alpine as builder
ARG OPENFORTIVPN_VERSION=v1.21.0
ARG GLIDER_VERSION=v0.16.3
# Build openfortivpn binary
RUN apk add --no-cache \
openssl-dev \
ppp \
ca-certificates \
curl \
&& apk add --no-cache --virtual .build-deps \
automake \
autoconf \
g++ \
gcc \
make \
go \
build-base \
&& mkdir -p "/usr/src/openfortivpn" \
&& cd "/usr/src/openfortivpn" \
&& curl -Ls "https://github.com/adrienverge/openfortivpn/archive/${OPENFORTIVPN_VERSION}.tar.gz" \
| tar xz --strip-components 1 \
&& aclocal \
&& autoconf \
&& automake --add-missing \
&& ./configure --prefix=/usr --sysconfdir=/etc \
&& make \
&& make install
# Build glider proxy binary
RUN mkdir -p /go/src/github.com/nadoo/glider && \
curl -sL https://github.com/nadoo/glider/archive/${GLIDER_VERSION}.tar.gz \
| tar xz -C /go/src/github.com/nadoo/glider --strip-components=1 && \
cd /go/src/github.com/nadoo/glider && \
awk '/^\s+_/{if (!/http/ && !/socks5/ && !/mixed/) $0="//"$0} {print}' feature.go > feature.go.tmp && \
mv feature.go.tmp feature.go && \
go build -v -ldflags "-s -w"
# Clean build deps
RUN apk del .build-deps
# Build final image
FROM alpine
RUN apk add --no-cache \
ca-certificates \
openssl \
ppp \
curl \
su-exec \
socat \
dpkg \
bash\
wget \
iptables \
net-tools \
iproute2 \
inotify-tools
COPY --from=builder /usr/bin/openfortivpn /usr/bin/openfortivpn
COPY --from=builder /go/src/github.com/nadoo/glider/glider /usr/bin/glider
COPY ./docker-entrypoint.sh /usr/bin/
COPY ./inotifywait.sh /usr/bin/
COPY ./docker-healcheck.sh /usr/bin/
RUN chmod +x \
/usr/bin/docker-entrypoint.sh \
/usr/bin/docker-healcheck.sh \
/usr/bin/inotifywait.sh
RUN mkdir /tmp/2fa/
RUN chmod -R 777 /tmp/2fa/
ENTRYPOINT ["docker-entrypoint.sh"]
ENV VPN_ADDR=""
ENV VPN_USER=""
ENV VPN_PASS=""
ENV VPN_2FA_DIR="/tmp/2fa/"
ENV VPN_2FA_FILE="/tmp/2fa/2fa.txt"
ENV ENABLE_IPTABLES_LEGACY=""
ENV ENABLE_PORT_FORWARDING=""
ENV SOCKS_PROXY_PORT="8443"
EXPOSE 8443/tcp
HEALTHCHECK --interval=30s --timeout=5s \
CMD bash /usr/bin/docker-healcheck.sh || pkill -SIGILL -f 1