Merge pull request #2305 from thaJeztah/generated_go_install

generated files: use "go install" to install binaries
master
Tõnis Tiigi 2021-08-13 10:00:53 -07:00 committed by GitHub
commit e8a3bb398f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -2,28 +2,27 @@
# protoc is dynamically linked to glibc to can't use golang:1.10-alpine
FROM golang:1.16-buster AS gobuild-base
# https://github.com/golang/protobuf/blob/v1.3.5/.travis.yml#L15
ARG PROTOC_VERSION=3.11.4
ARG GOGO_VERSION=v1.3.2
RUN apt-get update && apt-get --no-install-recommends install -y \
unzip \
&& true
# https://github.com/golang/protobuf/blob/v1.3.5/.travis.yml#L15
ARG PROTOC_VERSION=3.11.4
ARG TARGETOS TARGETARCH
RUN set -e; \
arch=$(echo $TARGETARCH | sed -e s/amd64/x86_64/ -e s/arm64/aarch_64/); \
wget -q https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip && unzip protoc-${PROTOC_VERSION}-${TARGETOS}-${arch}.zip -d /usr/local
RUN git clone https://github.com/gogo/protobuf.git /go/src/github.com/gogo/protobuf \
&& cd /go/src/github.com/gogo/protobuf \
&& git checkout -q $GOGO_VERSION \
&& go install ./protoc-gen-gogo ./protoc-gen-gogofaster ./protoc-gen-gogoslick
ARG GOGO_VERSION=v1.3.2
RUN --mount=target=/root/.cache,type=cache GO111MODULE=on go install \
github.com/gogo/protobuf/protoc-gen-gogo@${GOGO_VERSION} \
github.com/gogo/protobuf/protoc-gen-gogofaster@${GOGO_VERSION} \
github.com/gogo/protobuf/protoc-gen-gogoslick@${GOGO_VERSION}
ARG PROTOBUF_VERSION=v1.3.5
RUN git clone https://github.com/golang/protobuf.git /go/src/github.com/golang/protobuf \
&& cd /go/src/github.com/golang/protobuf \
&& git checkout -q $PROTOBUF_VERSION \
&& go install ./protoc-gen-go
RUN --mount=target=/root/.cache,type=cache GO111MODULE=on go install \
github.com/golang/protobuf/protoc-gen-go@${PROTOBUF_VERSION}
WORKDIR /go/src/github.com/moby/buildkit