FROM alpine:3.20

RUN apk add --no-cache \
      wireguard-tools \
      wireguard-go \
      iptables \
      ip6tables \
      iproute2 \
      bash \
      curl \
      tini

ENV WG_QUICK_USERSPACE_IMPLEMENTATION=wireguard-go \
    WG_SUDO=0

COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY healthcheck.sh /usr/local/bin/healthcheck.sh
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/healthcheck.sh

ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]
