grab upstream binaries instead of compile

This commit is contained in:
aptalca
2023-09-03 22:23:15 -04:00
parent 7f0cde6657
commit 2d90b6d8bd
+14 -25
View File
@@ -5,32 +5,21 @@ FROM ghcr.io/linuxserver/baseimage-alpine:3.18 AS buildstage
ARG MOD_VERSION ARG MOD_VERSION
RUN mkdir -p /root-layer/cloudflared
WORKDIR /src
RUN \ RUN \
apk add --no-cache \ echo "**** retrieve latest version ****" && \
build-base \ if [[ -z "${MOD_VERSION}" ]]; then \
git \ MOD_VERSION=$(curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest \
go | jq -rc ".tag_name"); \
fi && \
ENV GO111MODULE=on \ echo "**** grab binaries ****" && \
CGO_ENABLED=0 mkdir -p /root-layer/cloudflared && \
curl -fo \
RUN \ /root-layer/cloudflared/cloudflared-amd64 -L \
if [ -z "${MOD_VERSION}" ]; then \ "https://github.com/cloudflare/cloudflared/releases/download/${MOD_VERSION}/cloudflared-linux-amd64" && \
curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest \ curl -fo \
| jq -rc ".tag_name" \ /root-layer/cloudflared/cloudflared-arm64 -L \
| xargs -I TAG sh -c 'git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch TAG .'; \ "https://github.com/cloudflare/cloudflared/releases/download/${MOD_VERSION}/cloudflared-linux-arm64" && \
else \ chmod +x /root-layer/cloudflared/*
git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch ${MOD_VERSION} .; \
fi
RUN GOOS=linux GOARCH=amd64 make cloudflared
RUN mv cloudflared /root-layer/cloudflared/cloudflared-amd64
RUN GOOS=linux GOARCH=arm64 make cloudflared
RUN mv cloudflared /root-layer/cloudflared/cloudflared-arm64
COPY root/ /root-layer/ COPY root/ /root-layer/