Skip to content

Commit

Permalink
Merge pull request #43 from siomiz/multibase
Browse files Browse the repository at this point in the history
handle multiple base images, alleviates #42
  • Loading branch information
siomiz authored Mar 29, 2018
2 parents faa1828 + 98f8ff4 commit ddd1120
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 30 deletions.
42 changes: 12 additions & 30 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,26 @@
FROM debian:9-slim
FROM alpine:3.7 as prep

LABEL maintainer="Tomohisa Kusano <siomiz@gmail.com>" \
contributors="Ian Neubert <github.com/ianneub>; Ky-Anh Huynh <github.com/icy>; Max Kuchin <mkuchin@gmail.com>; maltalex <github.com/maltalex>"

ENV BUILD_VERSION=4.25-9656-rtm \
SHA256_SUM=c5a1791d69dc6d1c53fb574a3ce709707338520be797acbeac0a631c96c68330

#install wget
RUN apt-get update \
&& apt-get install -y wget \
&& rm -rf /var/lib/apt/lists/*

#Get, extract and build softether
RUN wget https://github.com/SoftEtherVPN/SoftEtherVPN_Stable/archive/v${BUILD_VERSION}.tar.gz \
&& echo "${SHA256_SUM} v${BUILD_VERSION}.tar.gz" | sha256sum -c --strict --quiet \
&& tar xf v${BUILD_VERSION}.tar.gz && rm v${BUILD_VERSION}.tar.gz \
&& apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libreadline7 \
libreadline-dev \
libssl1.1 \
libssl-dev \
libncurses5 \
libncurses5-dev \
zlib1g \
zlib1g-dev \
iptables \
unzip \
&& cd SoftEtherVPN_Stable-${BUILD_VERSION} && ./configure && make && make install \
&& cd / && rm -rf /SoftEtherVPN_Stable-${BUILD_VERSION} \
&& apt-get purge -y \
build-essential \
libreadline-dev \
libssl-dev \
lib32ncurses5-dev \
zlib1g-dev \
&& apt-get -y autoremove && rm -rf /var/lib/apt/lists/*
&& echo "${SHA256_SUM} v${BUILD_VERSION}.tar.gz" | sha256sum -c \
&& mkdir -p /usr/local/src \
&& tar -x -C /usr/local/src/ -f v${BUILD_VERSION}.tar.gz \
&& rm v${BUILD_VERSION}.tar.gz

FROM centos:7

COPY --from=prep /usr/local/src /usr/local/src

COPY copyables /

RUN /bin/bash /build-centos.sh \
&& /bin/rm /build-*.sh

RUN chmod +x /entrypoint.sh /gencert.sh \
&& rm -rf /opt && ln -s /usr/vpnserver /opt \
&& find /usr/bin/vpn* -type f ! -name vpnserver \
Expand Down
37 changes: 37 additions & 0 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM alpine:3.7 as prep

LABEL maintainer="Tomohisa Kusano <siomiz@gmail.com>" \
contributors="Ian Neubert <github.com/ianneub>; Ky-Anh Huynh <github.com/icy>; Max Kuchin <mkuchin@gmail.com>; maltalex <github.com/maltalex>"

ENV BUILD_VERSION=4.25-9656-rtm \
SHA256_SUM=c5a1791d69dc6d1c53fb574a3ce709707338520be797acbeac0a631c96c68330

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 -x -C /usr/local/src/ -f v${BUILD_VERSION}.tar.gz \
&& rm v${BUILD_VERSION}.tar.gz

FROM debian:9-slim

COPY --from=prep /usr/local/src /usr/local/src

COPY copyables /

RUN /bin/bash /build-debian.sh \
&& /bin/rm /build-*.sh

RUN chmod +x /entrypoint.sh /gencert.sh \
&& rm -rf /opt && ln -s /usr/vpnserver /opt \
&& find /usr/bin/vpn* -type f ! -name vpnserver \
-exec bash -c 'ln -s {} /opt/$(basename {})' \;

WORKDIR /usr/vpnserver/

VOLUME ["/usr/vpnserver/server_log/"]

ENTRYPOINT ["/entrypoint.sh"]

EXPOSE 500/udp 4500/udp 1701/tcp 1194/udp 5555/tcp

CMD ["/usr/bin/vpnserver", "execsvc"]
34 changes: 34 additions & 0 deletions copyables/build-centos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

echo "clean_requirements_on_remove=1" >> /etc/yum.conf

yum -y update \
&& yum -y install unzip \
&& yum -y groupinstall "Development Tools" \
&& yum -y install readline-devel ncurses-devel openssl-devel iptables sysvinit-tools

# Build SoftEtherVPN

cd /usr/local/src/SoftEtherVPN_Stable-*

cp src/makefiles/linux_64bit.mak Makefile

make

make install

cd /

rm -rf /usr/local/src/SoftEtherVPN_Stable-*

# Clean-up
# Keep iptables (for vpnserver) & sysvinit-tools (for pidof)

yum -y remove readline-devel ncurses-devel openssl-devel \
&& yum -y groupremove "Development Tools" \
&& yum clean all

rm -rf /var/log/* /var/cache/yum/* /var/lib/yum/*

exit 0

39 changes: 39 additions & 0 deletions copyables/build-debian.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

apt-get update

apt-get install -y --no-install-recommends \
build-essential \
libreadline7 \
libreadline-dev \
libssl1.1 \
libssl-dev \
libncurses5 \
libncurses5-dev \
zlib1g \
zlib1g-dev \
iptables \
unzip \

cd /usr/local/src/SoftEtherVPN_Stable-*

./configure

make

make install

cd /

rm -rf /usr/local/src/SoftEtherVPN_Stable-*

apt-get purge -y \
build-essential \
libreadline-dev \
libssl-dev \
lib32ncurses5-dev \
zlib1g-dev

apt-get -y autoremove

rm -rf /var/lib/apt/lists/*

0 comments on commit ddd1120

Please sign in to comment.