Skip to content

Commit cb501a6

Browse files
committed
fix: wireguard-go build
1 parent 525e6ef commit cb501a6

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

build/liqo/Dockerfile

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,29 @@ FROM alpine:3.20
44
ARG COMPONENT
55
ARG TARGETARCH
66

7+
RUN if [ "$COMPONENT" = "geneve" ] || [ "$COMPONENT" = "wireguard" ] || [ "$COMPONENT" = "gateway" ]; then \
8+
set -x; \
9+
apk add --no-cache iproute2 nftables bash wireguard-tools tcpdump conntrack-tools curl iputils; \
10+
fi
11+
12+
RUN if [ "$COMPONENT" = "wireguard" ]; then \
13+
set -e; \
14+
apk add --no-cache git curl; \
15+
GO_VERSION=1.22.4; \
16+
curl -L https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xz; \
17+
export PATH="/usr/local/go/bin:$PATH"; \
18+
git clone https://git.zx2c4.com/wireguard-go; cd wireguard-go; git checkout f333402bd9cbe0f3eeb02507bd14e23d7d639280; \
19+
CGO_ENABLED=0 GOOS=linux GOARCH=$(go env GOARCH) /usr/local/go/bin/go build -ldflags="-s -w" -o /usr/bin/wireguard-go; \
20+
cd .. && rm -rf wireguard-go; \
21+
rm -rf /usr/local/go; \
22+
apk del git curl; \
23+
fi
24+
725
# Copy the correct binary for the architecture
826
COPY ./bin/${TARGETARCH}/${COMPONENT}_linux_${TARGETARCH} /usr/bin/${COMPONENT}
927
RUN chmod +x /usr/bin/${COMPONENT}
1028
RUN ln -s /usr/bin/${COMPONENT} /usr/bin/liqo-component
1129

12-
RUN if [ "$COMPONENT" = "geneve" ] || [ "$COMPONENT" = "wireguard" ] || [ "$COMPONENT" = "gateway" ]; then \
13-
apk add --no-cache iproute2 nftables bash wireguard-tools tcpdump conntrack-tools curl iputils; \
14-
fi
15-
1630
WORKDIR /workspace
1731

1832
ENTRYPOINT ["/usr/bin/liqo-component"]

0 commit comments

Comments
 (0)