anchor.diff:  RUN go get istio.io/tools/protoc-gen-docs
   RUN go get istio.io/tools/cmd/annotations_prep
   
  -# Save some bytes in the container
  -RUN upx --lzma /go/bin/*
  +# Put the stuff we need in its final output location
  +RUN mkdir -p ${OUTDIR}/go/bin
  +RUN mkdir -p ${OUTDIR}/usr/include
   
  -# Cleanup
  -WORKDIR /
  -RUN apt-get purge -y \
  -    autoconf \
  -    libc-ares-dev \
  -    libssl-dev \
  -    libtool \
  -    unzip \
  -    upx \
  -    zlibc \
  -    zlib1g-dev \
  -    && apt-get autoremove -y \
  -    && apt-get clean \
  -    && rm -rf /var/lib/apt/lists/* \
  -    && rm -fr /home /tmp/* \
  -    && go clean -cache \
  -    && go clean -modcache
  +RUN cp -aR /tmp/bin/protoc ${OUTDIR}/go/bin
  +RUN cp -aR /tmp/include/* ${OUTDIR}/usr/include
  +RUN cp -aR /go/bin/* ${OUTDIR}/go/bin
  +
  +# Use inplace decompression on the go toolchain binaries
  +RUN upx --lzma ${OUTDIR}/go/bin/*
  +
  +# Create a golang toolchain context
  +FROM golang:1.12 as golang_context
  +
  +# Build a base os context
  +FROM ubuntu:xenial as base_os_context
  +
  +RUN apt-get update
  +RUN apt-get install -y make ca-certificates git
  +RUN apt-get autoremove -y
  +RUN apt-get clean
  +RUN rm -rf /var/lib/apt/lists/*
   
   # Setup to run the Go compiler with host-side build cache, test cache, and module cache
  +FROM scratch
  +
  +ENV GOROOT=/go
   ENV GOCACHE=/gocache
  -RUN rm -fr /go/pkg/mod
  +ENV PATH /go/bin:$PATH
   
  -# TODO: sadly this doesn't work as some processes launched in the container won't start. For example, make fails with the super useful:
  -#
  -#   make: *** [gen] Error 139
  -#
  -# There must be some additional dependency or variable that needs to be copied over
  -#
  -# Render the final image with minimal stuff, which saves over 300M compared to the fuller container image up to this point.
  -#FROM gcr.io/distroless/base:latest
  -#
  -#COPY --from=build_tools /usr/ /usr
  -#COPY --from=build_tools /go/ /go
  -#COPY --from=build_tools /bin/ /bin
  -#COPY --from=build_tools /lib/ /lib
  -#
  -#ENV GOPATH /go
  -#ENV PATH $GOPATH/bin:$PATH
  -#ENV GOCACHE=/gocache
  +COPY --from=base_os_context / /
  +COPY --from=build_tools_context /out/ /
  +COPY --from=golang_context /usr/local/go/ /go/
  +
  +WORKDIR /
  
positive.code: ENV GOIMPORTS_VERSION=379209517ffe
  ENV GOLANGCI_LINT_VERSION=v1.16.0
  
  # Update distro and install dependencies
  RUN apt-get update && apt-get install -y --no-install-recommends \
      autoconf \
      build-essential \
  
negative.code: WORKDIR /tmp
  ADD https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip /tmp/
  RUN unzip /tmp/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip
  
  # Install necessary protoc includes
  RUN mkdir -p ${OUTDIR}/usr/include/protobuf/google/protobuf
  RUN mkdir -p ${OUTDIR}/usr/include/protobuf/google/rpc
  RUN mkdir -p ${OUTDIR}/usr/include/protobuf/gogoproto
  
  RUN for f in any duration descriptor empty struct timestamp wrappers; do \
              curl -L -o ${OUTDIR}/usr/include/protobuf/google/protobuf/${f}.proto https://raw.githubusercontent.com/google/protobuf/master/src/google/protobuf/${f}.proto; \
          done
  RUN for f in code error_details status http; do \
              curl -L -o ${OUTDIR}/usr/include/protobuf/google/rpc/${f}.proto https://raw.githubusercontent.com/istio/gogo-genproto/master/googleapis/google/rpc/${f}.proto; \
          done
  RUN curl -L -o ${OUTDIR}/usr/include/protobuf/gogoproto/gogo.proto https://raw.githubusercontent.com/gogo/protobuf/master/gogoproto/gogo.proto
  
  # Install external dependencies
  RUN GO111MODULE=on go get github.com/golang/protobuf/protoc-gen-go@${GOLANG_PROTOBUF_VERSION}
  