-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile-ubuntu
69 lines (56 loc) · 2.62 KB
/
Dockerfile-ubuntu
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
# syntax=docker/dockerfile-upstream:master-labs
FROM ubuntu:latest AS builder
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ENV REPOSITORY https://github.com/SoftEtherVPN/SoftEtherVPN.git
WORKDIR /tmp/softether
ADD --keep-git-dir=true ${REPOSITORY} /tmp/softether
RUN \
# Install build tools
apt-get update -y && \
apt-get install git g++ make libssl-dev cmake pkg-config \
libsodium-dev libncurses5-dev zlib1g-dev libreadline-dev \
ca-certificates -y --no-install-recommends && \
# Init submodules
git submodule update --init --recursive && \
# Build
if [ "${TARGETARCH}" == "arm64" ]; then echo "Forcing to use neon on arm64 platform manually."; sed -ir 's|set(BLAKE2_SRC_PATH $<IF:$<BOOL:${HAS_SSE2}>,${TOP_DIRECTORY}/3rdparty/BLAKE2/sse,${TOP_DIRECTORY}/3rdparty/BLAKE2/ref>)|set(BLAKE2_SRC_PATH ${TOP_DIRECTORY}/3rdparty/BLAKE2/neon)|' ./src/Cedar/CMakeLists.txt; sed -ir 's|set(BLAKE2_SRC $<IF:$<BOOL:${HAS_SSE2}>,${BLAKE2_SRC_PATH}/blake2s.c,${BLAKE2_SRC_PATH}/blake2s-ref.c>)|set(BLAKE2_SRC ${BLAKE2_SRC_PATH}/blake2s-neon.c)|' ./src/Cedar/CMakeLists.txt; fi && \
./configure && make --silent -C build && make --silent -C build install
# Second stage
FROM ubuntu:latest
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
COPY --from=builder /tmp/softether/build/libcedar.so /usr/lib
COPY --from=builder /tmp/softether/build/libmayaqua.so /usr/lib
COPY --from=builder /usr/local/libexec/softether/vpnserver/ /usr/local/libexec/softether/vpnserver/
COPY --from=builder /usr/local/libexec/softether/vpncmd/ /usr/local/libexec/softether/vpncmd/
COPY --from=builder /usr/local/bin/vpnserver /usr/bin/softether-vpnsrv
COPY --from=builder /usr/local/bin/vpncmd /usr/bin/softether-vpncmd
RUN \
# Installing libs and packages
apt-get update -y && \
apt-get install tini libsodium-dev libreadline-dev \
iptables iproute2 net-tools dnsmasq bridge-utils isc-dhcp-client -y --no-install-recommends && \
# Cleaning apt cache
apt-get clean -y && \
rm -rf /var/lib/apt/lists/* && \
mkdir -p /conf && \
ln -s /usr/local/libexec/softether/vpnserver/ /etc/softether && \
# Create the tun network adapter
echo "tun" >> /etc/modules && \
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf && \
mkdir -p /dev/net && \
mknod /dev/net/tun c 10 200 && \
mkdir -p /docker.init.d
# Advise to open necessary ports
EXPOSE 1443/tcp 992/tcp 1194/tcp 1194/udp 5555/tcp 500/udp 4500/udp 1701/udp
# Advise to create necessary volumes
VOLUME [ "/conf" ]
# Move host file system
COPY ./.docker/hostfs /
COPY --chmod=777 ./dist/pipe-${TARGETOS}-${TARGETARCH}${TARGETVARIANT} /usr/bin/pipe
# Set working directory back
WORKDIR /
ENTRYPOINT ["tini", "pipe"]