stagex/packages/protoc-gen-openapiv2/Containerfile

37 lines
993 B
Text
Raw Normal View History

FROM scratch as base
ENV VERSION=2.17.1
ENV SRC_HASH=092bc95544d6089ccea00fb124a0a81eadf212bf06d61a4ba422ad331bf3c6da
ENV SRC_FILE=v${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/grpc-ecosystem/grpc-gateway/archive/refs/tags/${SRC_FILE}
FROM base as fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch as build
COPY --from=stagex/busybox . /
COPY --from=stagex/go . /
COPY --from=stagex/ca-certificates . /
RUN tar -xvf v${VERSION}.tar.gz
WORKDIR grpc-gateway-${VERSION}
ENV GOPATH=${PWD}/cache/go
ENV GOCACHE=${PWD}/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 GOFLAGS=-trimpath
RUN mkdir -p ${GOPATH}
RUN go build -o bin/protoc-gen-openapiv2 ./protoc-gen-openapiv2
from build as install
RUN <<-EOF
set -eux
mkdir -p /rootfs/usr/bin/
cp bin/protoc-gen-openapiv2 /rootfs/usr/bin/
EOF
FROM stagex/filesystem as package
COPY --from=install /rootfs/./ /