1- FROM debian:trixie-slim
2-
3- RUN apt-get update && \
4- apt-get install -y --no-install-recommends \
5- wireguard-tools iproute2 iptables \
6- rclone rsync lsyncd sshfs fuse3 \
7- openssh-client dropbear \
8- socat netcat-openbsd curl wget jq \
9- inotify-tools tcpdump mtr-tiny dnsutils \
10- procps strace tmux file less zstd && \
11- rm -rf /var/lib/apt/lists/* && \
1+ FROM alpine:3.23
2+
3+ RUN apk add --no-cache \
4+ tini bash \
5+ wireguard-tools iproute2 iptables \
6+ rclone rsync lsyncd sshfs fuse3 \
7+ openssh-client-default dropbear \
8+ socat netcat-openbsd curl wget jq \
9+ inotify-tools tcpdump mtr bind-tools \
10+ procps strace tmux file less zstd stunnel && \
1211 mkdir -p /etc/wireguard /data
1312
1413VOLUME ["/data" , "/etc/wireguard" ]
1514EXPOSE 51820/udp
1615
16+ HEALTHCHECK --interval=30s --timeout=5s \
17+ CMD wg show | grep -q "latest handshake" || exit 1
18+
1719RUN cat > /entrypoint.sh << 'SCRIPT'
1820# !/bin/bash
1921set -e
@@ -27,7 +29,6 @@ cleanup() {
2729}
2830trap cleanup SIGTERM SIGINT
2931
30- # generate default wg0 only if no configs exist
3132if ! ls /etc/wireguard/wg*.conf 2>/dev/null | grep -q .; then
3233 [ -f /etc/wireguard/privatekey ] || {
3334 wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey
@@ -37,17 +38,16 @@ if ! ls /etc/wireguard/wg*.conf 2>/dev/null | grep -q .; then
3738 cat > /etc/wireguard/wg0.conf << EOF
3839[Interface]
3940PrivateKey = $(cat /etc/wireguard/privatekey)
40- Address = ${WG_IP:-192.168.192.2 }/32
41+ Address = ${WG_IP:-100.87.143.201 }/32
4142ListenPort = 51820
4243
4344[Peer]
4445PublicKey = ${WG_CLIENT_PUBKEY:-CHANGEME}
45- AllowedIPs = ${WG_CLIENT_IP:-192.168.192 .1}/32
46+ AllowedIPs = ${WG_CLIENT_IP:-100.87.143 .1}/32
4647EOF
4748 chmod 600 /etc/wireguard/wg0.conf
4849fi
4950
50- # bring up all WG interfaces
5151for conf in /etc/wireguard/wg*.conf; do
5252 [ -f "$conf" ] && wg-quick up "$(basename " ${conf%.conf}")" && \
5353 echo "[INFO] up: $(basename " ${conf%.conf}")"
@@ -57,4 +57,5 @@ exec ${CMD:-sleep infinity}
5757SCRIPT
5858
5959RUN chmod +x /entrypoint.sh
60+ ENTRYPOINT ["/sbin/tini" , "--" ]
6061CMD ["/entrypoint.sh" ]
0 commit comments