2024-08-08 07:47:42 +00:00
|
|
|
FROM scratch AS base
|
2024-05-10 23:09:47 +00:00
|
|
|
ENV VERSION=2.19.1
|
|
|
|
ENV SRC_HASH=89d78abbe4aca77ce7823223945e852aec31c87a8c7aac084340ef9f53fd9637
|
|
|
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
|
|
|
ENV SRC_SITE=https://github.com/grpc-ecosystem/grpc-gateway/archive/refs/tags/${SRC_FILE}
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM base AS fetch
|
2024-05-10 23:09:47 +00:00
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM fetch AS build
|
2024-05-10 23:09:47 +00:00
|
|
|
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-grpc-gateway ./protoc-gen-grpc-gateway
|
|
|
|
|
|
|
|
from build as install
|
|
|
|
RUN <<-EOF
|
|
|
|
set -eux
|
|
|
|
mkdir -p /rootfs/usr/bin/
|
|
|
|
cp bin/protoc-gen-grpc-gateway /rootfs/usr/bin/
|
|
|
|
EOF
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM stagex/filesystem AS package
|
2024-05-10 23:09:47 +00:00
|
|
|
COPY --from=install /rootfs/./ /
|