Add Dockerfile and entrypoint script

This commit is contained in:
Jordan Potter 2019-02-14 12:03:36 -08:00
parent fa70bb976d
commit 3d28131872
2 changed files with 31 additions and 0 deletions

8
Dockerfile Normal file
View file

@ -0,0 +1,8 @@
FROM ubuntu:latest
RUN apt-get update && apt-get install -y software-properties-common openresolv iptables iproute2
RUN add-apt-repository ppa:wireguard/wireguard && apt-get update && apt-get install -y wireguard-tools
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

23
entrypoint.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
set -e
interfaces=`find /etc/wireguard -type f`
if [[ -z $interfaces ]]; then
echo "No interface found in /etc/wireguard" >&2
exit 1
fi
interface=`echo $interfaces | head -n 1`
wg-quick up $interface
shutdown () {
wg-quick down $interface
exit 0
}
trap shutdown SIGTERM SIGINT SIGQUIT
sleep infinity &
wait $!