2024-08-08 07:47:42 +00:00
|
|
|
FROM scratch AS base
|
2024-05-10 23:09:47 +00:00
|
|
|
ENV VERSION=1.5.4
|
|
|
|
ENV SRC_HASH=d75e6960ecfabaaa83a7261b1b630d24e9c63aca79615fb15bf33e11b62fd019
|
|
|
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
|
|
|
ENV SRC_SITE=https://github.com/golang/protobuf/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
|
2024-08-26 01:18:52 +00:00
|
|
|
WORKDIR /protobuf-${VERSION}
|
2024-08-27 06:51:27 +00:00
|
|
|
ENV GOPATH=/cache/go
|
|
|
|
ENV GOCACHE=/cache/
|
2024-05-10 23:09:47 +00:00
|
|
|
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-go ./protoc-gen-go
|
|
|
|
|
2024-08-08 07:50:50 +00:00
|
|
|
FROM build AS install
|
2024-05-10 23:09:47 +00:00
|
|
|
RUN <<-EOF
|
|
|
|
set -eux
|
|
|
|
mkdir -p /rootfs/usr/bin/
|
|
|
|
cp bin/protoc-gen-go /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/./ /
|