Skip to content

Commit 41f644c

Browse files
authored
Merge pull request #11 from iPromKnight/i-branch-1
chore: manually build architecture support for wireguard-go
2 parents 09ab07b + a372d76 commit 41f644c

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

apps/pia/Dockerfile

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ RUN apk update && apk upgrade && \
77

88
RUN 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\nconst Version = "%s"\n' "${WIREGUARD_TAG}" > version.go
30+
31+
# Build binary
32+
RUN make wireguard-go
33+
1034
FROM ghcr.io/ipromknight/alpine:rolling
1135

1236
RUN 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
2751
RUN 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
3354
ADD 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/
4566
COPY --from=cloner /source/extra/pf.sh /scripts/
4667
COPY --from=cloner /source/extra/pia-auth.sh /scripts/
4768
COPY --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
4870
RUN chmod 755 /scripts/*
4971

5072
# Store persistent PIA stuff here (auth token, server list)

0 commit comments

Comments
 (0)