From 53df6849f763e5a0309579983b9170ad1a5a6fdb Mon Sep 17 00:00:00 2001 From: Daan Date: Thu, 12 Dec 2024 11:03:39 +0100 Subject: [PATCH] Working prototype with AWG --- Dockerfile | 29 +++++++++++++++++++++++++++++ entrypoint.sh | 6 +++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b2fec8..21abc9b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,35 @@ +FROM golang:1.23 AS compiler +WORKDIR /go + +RUN apt-get update && apt-get install -y --no-install-recommends \ + git make bash build-essential \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN git clone --depth=1 https://github.com/amnezia-vpn/amneziawg-tools.git && \ + git clone --depth=1 https://github.com/amnezia-vpn/amneziawg-go.git +RUN cd /go/amneziawg-tools/src && make + +RUN cd /go/amneziawg-go && \ + go get -u ./... && \ + go mod tidy && \ + make && \ + chmod +x /go/amneziawg-go/amneziawg-go /go/amneziawg-tools/src/wg /go/amneziawg-tools/src/wg-quick/linux.bash +RUN echo "DONE AmneziaWG" + +### INTERMEDIATE STAGE +FROM scratch AS bins +COPY --from=compiler /go/amneziawg-go/amneziawg-go /amneziawg-go +COPY --from=compiler /go/amneziawg-tools/src/wg /awg +COPY --from=compiler /go/amneziawg-tools/src/wg-quick/linux.bash /awg-quick + +# FINAL STAGE FROM alpine:latest LABEL maintainer="dselen@nerthus.nl" +COPY --from=bins /amneziawg-go /usr/bin/amneziawg-go +COPY --from=bins /awg /usr/bin/awg +COPY --from=bins /awg-quick /usr/bin/awg-quick + # Declaring environment variables, change Peernet to an address you like, standard is a 24 bit subnet. ARG wg_net="10.0.0.1" ARG wg_port="51820" diff --git a/entrypoint.sh b/entrypoint.sh index c39fe87..bd633b7 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -212,14 +212,14 @@ ensure_blocking() { echo -e "\nEnsuring container continuation." # Find and tail the latest error and access logs if they exist - local logdir="/opt/wireguarddashboard/src/log" + local logdir="${WGDASH}/src/log" latestErrLog=$(find "$logdir" -name "error_*.log" -type f -print | sort -r | head -n 1) - latestAccLog=$(find "$logdir" -name "access_*.log" -type f -print | sort -r | head -n 1) + #latestAccLog=$(find "$logdir" -name "access_*.log" -type f -print | sort -r | head -n 1) # Removed access line due to console spam. # Only tail the logs if they are found if [ -n "$latestErrLog" ] || [ -n "$latestAccLog" ]; then - tail -f "$latestErrLog" "$latestAccLog" + tail -f "$latestErrLog" else echo "No log files found to tail." fi