@@ -4,15 +4,36 @@ FROM alpine:3.20
44ARG COMPONENT
55ARG 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+ # Map Docker TARGETARCH to Go architecture names \
17+ case "$TARGETARCH" in \
18+ amd64) GO_ARCH=amd64 ;; \
19+ arm64) GO_ARCH=arm64 ;; \
20+ arm) GO_ARCH=armv6l ;; \
21+ *) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \
22+ esac; \
23+ curl -L https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz | tar -C /usr/local -xz; \
24+ export PATH="/usr/local/go/bin:$PATH" ; \
25+ git clone https://git.zx2c4.com/wireguard-go; cd wireguard-go; git checkout f333402bd9cbe0f3eeb02507bd14e23d7d639280; \
26+ CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH /usr/local/go/bin/go build -ldflags="-s -w" -o /usr/bin/wireguard-go; \
27+ cd .. && rm -rf wireguard-go; \
28+ rm -rf /usr/local/go; \
29+ apk del git curl; \
30+ fi
31+
732# Copy the correct binary for the architecture
833COPY ./bin/${TARGETARCH}/${COMPONENT}_linux_${TARGETARCH} /usr/bin/${COMPONENT}
934RUN chmod +x /usr/bin/${COMPONENT}
1035RUN ln -s /usr/bin/${COMPONENT} /usr/bin/liqo-component
1136
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-
1637WORKDIR /workspace
1738
1839ENTRYPOINT ["/usr/bin/liqo-component" ]
0 commit comments