stagex/packages/protoc-gen-go/Containerfile

37 lines
955 B
Text
Raw Normal View History

FROM scratch as base
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}
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 protobuf-${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-go ./protoc-gen-go
from build as install
RUN <<-EOF
set -eux
mkdir -p /rootfs/usr/bin/
cp bin/protoc-gen-go /rootfs/usr/bin/
EOF
FROM stagex/filesystem as package
COPY --from=install /rootfs/./ /