add versioning

This commit is contained in:
aptalca
2021-05-26 22:58:53 -04:00
parent c4dc8bfe61
commit d8cb836b4d
2 changed files with 30 additions and 14 deletions
+19 -13
View File
@@ -1,7 +1,9 @@
# Build container
FROM golang:alpine AS buildstage
RUN mkdir /cloudflared
ARG CLOUDFLARED_TAG
RUN mkdir -p /root-layer/cloudflared
WORKDIR /src
RUN apk --no-cache add git build-base curl jq
@@ -9,26 +11,30 @@ RUN apk --no-cache add git build-base curl jq
ENV GO111MODULE=on \
CGO_ENABLED=0
RUN curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest \
| jq -rc ".tag_name" \
| xargs -I TAG sh -c 'git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch TAG .'
RUN \
if [ -z "${CLOUDFLARED_TAG}" ]; then \
curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest \
| jq -rc ".tag_name" \
| xargs -I TAG sh -c 'git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch TAG .'; \
else \
git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch ${CLOUDFLARED_TAG} .; \
fi
RUN GOOS=linux GOARCH=amd64 make cloudflared
RUN mv cloudflared /cloudflared/cloudflared-amd64
RUN mv cloudflared /root-layer/cloudflared/cloudflared-amd64
RUN GOOS=linux GOARCH=arm64 make cloudflared
RUN mv cloudflared /cloudflared/cloudflared-arm64
RUN mv cloudflared /root-layer/cloudflared/cloudflared-arm64
RUN GOOS=linux GOARCH=arm make cloudflared
RUN mv cloudflared /cloudflared/cloudflared-armhf
RUN mv cloudflared /root-layer/cloudflared/cloudflared-armhf
# Runtime container
COPY root/ /root-layer/
## Single layer deployed image ##
FROM scratch
WORKDIR /
LABEL maintainer="Spunkie"
# copy cloudflared bins
COPY --from=buildstage /cloudflared /cloudflared
# copy local files
COPY root/ /
# Add files from buildstage
COPY --from=buildstage /root-layer/ /