Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions build/liqo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,36 @@ FROM alpine:3.20
ARG COMPONENT
ARG TARGETARCH

RUN if [ "$COMPONENT" = "geneve" ] || [ "$COMPONENT" = "wireguard" ] || [ "$COMPONENT" = "gateway" ]; then \
set -x; \
apk add --no-cache iproute2 nftables bash wireguard-tools tcpdump conntrack-tools curl iputils; \
fi

RUN if [ "$COMPONENT" = "wireguard" ]; then \
set -e; \
apk add --no-cache git curl; \
GO_VERSION=1.22.4; \
# Map Docker TARGETARCH to Go architecture names \
case "$TARGETARCH" in \
amd64) GO_ARCH=amd64 ;; \
arm64) GO_ARCH=arm64 ;; \
arm) GO_ARCH=armv6l ;; \
*) echo "Unsupported architecture: $TARGETARCH" && exit 1 ;; \
esac; \
curl -L https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz | tar -C /usr/local -xz; \
export PATH="/usr/local/go/bin:$PATH"; \
git clone https://git.zx2c4.com/wireguard-go; cd wireguard-go; git checkout f333402bd9cbe0f3eeb02507bd14e23d7d639280; \
CGO_ENABLED=0 GOOS=linux GOARCH=$TARGETARCH /usr/local/go/bin/go build -ldflags="-s -w" -o /usr/bin/wireguard-go; \
cd .. && rm -rf wireguard-go; \
rm -rf /usr/local/go; \
apk del git curl; \
fi

# Copy the correct binary for the architecture
COPY ./bin/${TARGETARCH}/${COMPONENT}_linux_${TARGETARCH} /usr/bin/${COMPONENT}
RUN chmod +x /usr/bin/${COMPONENT}
RUN ln -s /usr/bin/${COMPONENT} /usr/bin/liqo-component

RUN if [ "$COMPONENT" = "geneve" ] || [ "$COMPONENT" = "wireguard" ] || [ "$COMPONENT" = "gateway" ]; then \
apk add --no-cache iproute2 nftables bash wireguard-tools tcpdump conntrack-tools curl iputils; \
fi

WORKDIR /workspace

ENTRYPOINT ["/usr/bin/liqo-component"]
8 changes: 1 addition & 7 deletions build/liqo/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@ set -e
set -o nounset
set -o pipefail

usage() {
echo "Usage: $0 [-m] [-p] <component-folder>"
echo " -p Push the built image to the registry"
echo " -h Show this help message"
}

if [ $# -ne 1 ]; then
usage
echo "Usage: $0 <component-folder>"
exit 1
fi

Expand Down