stagex/packages/grpcurl/Containerfile

37 lines
993 B
Text
Raw Normal View History

2024-08-08 07:47:42 +00:00
FROM scratch AS base
2024-03-25 21:21:38 +00:00
ENV VERSION=1.8.9
2024-04-01 04:12:56 +00:00
ENV SRC_HASH=962fe7d3da7653519d2975e130244af9286db32041b0745613aebf89949a9009
2024-03-25 21:21:38 +00:00
ENV SRC_FILE=v${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/fullstorydev/grpcurl/archive/refs/tags/${SRC_FILE}
ENV GOCACHE=/cache/
ENV GOWORK=off
ENV GOPROXY=https://proxy.golang.org,direct
ENV GOSUMDB=sum.golang.org
ENV CGO_ENABLED=0
ENV GOHOSTOS=linux
ENV GOHOSTARCH=amd64
ENV GOLDFLAGS="-w -extldflags \"-static\" -X \"main.version=${VERSION}\""
2024-08-08 07:47:42 +00:00
FROM base AS fetch
2024-03-25 21:21:38 +00:00
COPY --from=stagex/busybox . /
COPY --from=stagex/go . /
COPY --from=stagex/ca-certificates . /
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
RUN tar -xvf ${SRC_FILE}
2024-08-26 01:18:52 +00:00
WORKDIR /grpcurl-${VERSION}
2024-03-25 21:21:38 +00:00
ENV GOPATH="/grpcurl-${VERSION}"
RUN go get ./...
2024-08-08 07:47:42 +00:00
FROM fetch AS build
2024-03-25 21:21:38 +00:00
RUN --network=none go build -trimpath -v ./cmd/grpcurl
2024-08-08 07:50:50 +00:00
FROM build AS install
2024-03-25 21:21:38 +00:00
RUN <<-EOF
2024-04-11 20:09:20 +00:00
set -eu
2024-03-25 21:21:38 +00:00
mkdir -p /rootfs/usr/bin/
cp grpcurl /rootfs/usr/bin/
EOF
2024-08-08 07:47:42 +00:00
FROM stagex/filesystem AS package
2024-03-25 21:21:38 +00:00
COPY --from=install /rootfs/./ /