-
Notifications
You must be signed in to change notification settings - Fork 176
/
Dockerfile.opensuse
78 lines (59 loc) · 2.64 KB
/
Dockerfile.opensuse
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
# Use openSUSE Leap as the base image for the first stage (prep)
FROM opensuse/tumbleweed:latest as prep
# Set the locale-related environment variables to valid locales
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV LC_CTYPE=en_US.UTF-8
ENV LC_MESSAGES=en_US.UTF-8
ENV LC_COLLATE=en_US.UTF-8
LABEL maintainer="Tomohisa Kusano <[email protected]>" \
contributors="See CONTRIBUTORS file <https://github.com/siomiz/SoftEtherVPN/blob/master/CONTRIBUTORS>"
ENV BUILD_VERSION=4.43-9799-beta \
SHA256_SUM=9153a95574f2afd8259ff729e6da3a9898211b69d7d391419270935c8482888c
# Install required packages using zypper (openSUSE package manager)
RUN zypper --non-interactive in wget tar gzip coreutils zip unzip
# Download and extract SoftEtherVPN source code
RUN wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/archive/v${BUILD_VERSION}.tar.gz \
&& echo "${SHA256_SUM} v${BUILD_VERSION}.tar.gz" | sha256sum -c \
&& mkdir -p /usr/local/src \
&& tar -xzf v${BUILD_VERSION}.tar.gz -C /usr/local/src/ \
&& rm v${BUILD_VERSION}.tar.gz
# Continue with the second stage using openSUSE as the base image (build)
FROM opensuse/tumbleweed:latest as build
# Copy the previously extracted SoftEtherVPN source code from the prep stage
COPY --from=prep /usr/local/src /usr/local/src
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV LC_CTYPE=en_US.UTF-8
ENV LC_MESSAGES=en_US.UTF-8
ENV LC_COLLATE=en_US.UTF-8
# Install necessary build dependencies using zypper (openSUSE package manager)
RUN zypper --non-interactive in gcc make ncurses-devel libopenssl-devel readline-devel zip zlib-devel unzip \
&& cd /usr/local/src/SoftEtherVPN_Stable-* \
&& ./configure \
&& make \
&& make install \
&& touch /usr/vpnserver/vpn_server.config \
&& zip -r9 /artifacts.zip /usr/vpn* /usr/bin/vpn*
# Continue with the final stage using openSUSE as the base image
FROM opensuse/tumbleweed:latest
COPY --from=build /artifacts.zip /
COPY copyables /
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV LC_CTYPE=en_US.UTF-8
ENV LC_MESSAGES=en_US.UTF-8
ENV LC_COLLATE=en_US.UTF-8
RUN zypper --non-interactive in bash iptables openssl-devel zip unzip \
&& chmod +x /entrypoint.sh /gencert.sh \
&& unzip -o /artifacts.zip -d / \
&& rm /artifacts.zip \
&& rm -rf /opt \
&& ln -s /usr/vpnserver /opt \
&& find /usr/bin/vpn* -type f ! -name vpnserver \
-exec sh -c 'ln -s {} /opt/$(basename {})' \;
WORKDIR /usr/vpnserver/
VOLUME ["/usr/vpnserver/server_log/", "/usr/vpnserver/packet_log/", "/usr/vpnserver/security_log/"]
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 500/udp 4500/udp 1701/tcp 1194/udp 5555/tcp 443/tcp
CMD ["/usr/bin/vpnserver", "execsvc"]