@@ -7,6 +7,30 @@ RUN apk update && apk upgrade && \
77
88RUN git clone -b $VERSION https://github.com/thrnz/docker-wireguard-pia.git /source
99
10+ FROM --platform=$BUILDPLATFORM golang:1.23.1-alpine AS wireguard-builder
11+
12+ ARG TARGETOS
13+ ARG TARGETARCH
14+ ARG WIREGUARD_TAG=0.0.20250522
15+ ENV WIREGUARD_TAG=${WIREGUARD_TAG}
16+
17+ RUN apk add --no-cache wget unzip make git
18+
19+ WORKDIR /src
20+
21+ # Download and extract
22+ RUN wget https://github.com/WireGuard/wireguard-go/archive/refs/tags/${WIREGUARD_TAG}.zip -O wg.zip && \
23+ unzip wg.zip && \
24+ mv wireguard-go-${WIREGUARD_TAG} wireguard-go
25+
26+ WORKDIR /src/wireguard-go
27+
28+ # Inject version.go to avoid git describe issues
29+ RUN printf 'package main\n\n const Version = "%s"\n ' "${WIREGUARD_TAG}" > version.go
30+
31+ # Build binary
32+ RUN make wireguard-go
33+
1034FROM ghcr.io/ipromknight/alpine:rolling
1135
1236RUN apk add --no-cache \
@@ -26,9 +50,6 @@ RUN apk add --no-cache \
2650# To avoid confusion, also suppress the error message that displays even when pre-set to 1 on container creation
2751RUN sed -i 's/cmd sysctl.*/set +e \&\& sysctl -q net.ipv4.conf.all.src_valid_mark=1 \& > \/ dev\/ null \&\& set -e/' /usr/bin/wg-quick
2852
29- # Install wireguard-go as a fallback if wireguard is not supported by the host OS or Linux kernel
30- RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing wireguard-go
31-
3253# Get the PIA CA cert
3354ADD https://raw.githubusercontent.com/pia-foss/desktop/master/daemon/res/ca/rsa_4096.crt /rsa_4096.crt
3455
@@ -45,6 +66,7 @@ COPY --from=cloner /source/pf_success.sh /scripts/
4566COPY --from=cloner /source/extra/pf.sh /scripts/
4667COPY --from=cloner /source/extra/pia-auth.sh /scripts/
4768COPY --from=cloner /source/extra/wg-gen.sh /scripts/
69+ COPY --from=wireguard-builder --chmod=0755 /src/wireguard-go/wireguard-go /usr/local/bin/wireguard-go
4870RUN chmod 755 /scripts/*
4971
5072# Store persistent PIA stuff here (auth token, server list)
0 commit comments