2018-09-14 05:35:38 +00:00
|
|
|
# protoc is dynamically linked to glibc to can't use golang:1.11-alpine
|
|
|
|
FROM golang:1.11 AS gobuild-base
|
2018-03-26 10:52:36 +00:00
|
|
|
ARG PROTOC_VERSION=3.1.0
|
|
|
|
ARG GOGO_VERSION=master
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
git \
|
|
|
|
unzip \
|
|
|
|
&& true
|
|
|
|
RUN wget -q https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local
|
|
|
|
|
|
|
|
RUN go get -d github.com/gogo/protobuf/protoc-gen-gogofaster \
|
|
|
|
&& cd /go/src/github.com/gogo/protobuf \
|
|
|
|
&& git checkout -q $GOGO_VERSION \
|
|
|
|
&& go install ./protoc-gen-gogo ./protoc-gen-gogofaster ./protoc-gen-gogoslick
|
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/moby/buildkit
|
|
|
|
COPY . .
|
|
|
|
RUN go generate ./...
|
|
|
|
|
|
|
|
# Generate into a subdirectory because if it is in the root then the
|
|
|
|
# extraction with `docker export` ends up putting `.dockerenv`, `dev`,
|
|
|
|
# `sys` and `proc` into the source directory. With this we can use
|
|
|
|
# `tar --strip-components=1 generated-files` on the output of `docker
|
|
|
|
# export`.
|
2018-09-14 18:36:19 +00:00
|
|
|
FROM gobuild-base AS generated
|
2018-03-26 10:52:36 +00:00
|
|
|
RUN mkdir /generated-files
|
|
|
|
RUN find . -name "*.pb.go" ! -path ./vendor/\* | tar -cf - --files-from - | tar -C /generated-files -xf -
|
|
|
|
|
|
|
|
FROM scratch AS update
|
|
|
|
|
2018-09-14 18:36:19 +00:00
|
|
|
COPY --from=generated generated-files /generated-files
|
2018-03-26 10:52:36 +00:00
|
|
|
|
|
|
|
FROM gobuild-base AS validate
|
|
|
|
|
|
|
|
RUN ./hack/validate-generated-files check
|