Added dockerfile for build alpine based boringtun wireguard client

This commit is contained in:
2023-02-27 22:14:47 +00:00
parent babbc67a66
commit c7c6d48fad
5 changed files with 83 additions and 0 deletions
Executable
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -e
declare -r WG_INTERFACE=${1:-wg0}
function infinite_loop() {
# Handle shutdown behavior
trap 'shutdown_wg "$1"' SIGTERM SIGINT SIGQUIT
sleep infinity &
wait $!
}
function shutdown_wg() {
echo "Shutting down Wireguard (boringtun)"
wg-quick down "$1"
exit 0
}
function start_wg() {
echo "Starting up Wireguard (boringtun)"
wg-quick up "$1"
infinite_loop "$1"
}
#if [[ "$1" =~ ^wg.*$ ]]; then
if [ -f "/etc/wireguard/${WG_INTERFACE}.conf" ]; then
start_wg ${WG_INTERFACE}
else
exec "$@"
fi