mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-15 11:46:06 +00:00
Use layers in the builder Dockerfile (#1907)
Using layers can simplify iteration on the builder image itself, and shorten build times when only one command is changed Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
This commit is contained in:
committed by
KubeKween
parent
2e849dcb99
commit
01b0b05762
+26
-25
@@ -14,30 +14,31 @@
|
||||
|
||||
FROM golang:1.12
|
||||
|
||||
RUN mkdir -p /go/src/k8s.io && \
|
||||
cd /go/src/k8s.io && \
|
||||
git config --global advice.detachedHead false && \
|
||||
git clone -b kubernetes-1.15.3 https://github.com/kubernetes/code-generator && \
|
||||
git clone -b kubernetes-1.15.3 https://github.com/kubernetes/apimachinery && \
|
||||
# vendor code-generator go modules to be compatible with pre-1.15
|
||||
cd /go/src/k8s.io/code-generator && GO111MODULE=on go mod vendor && \
|
||||
go get -d sigs.k8s.io/controller-tools/cmd/controller-gen && \
|
||||
cd /go/src/sigs.k8s.io/controller-tools && GO111MODULE=on go mod vendor && \
|
||||
go get golang.org/x/tools/cmd/goimports && \
|
||||
cd /go/src/golang.org/x/tools && \
|
||||
git checkout 40a48ad93fbe707101afb2099b738471f70594ec && \
|
||||
go install ./cmd/goimports && \
|
||||
echo chmod -R a+w /go && \
|
||||
# download & install protoc
|
||||
apt-get update && apt-get install -y unzip && \
|
||||
wget --quiet https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip && \
|
||||
RUN mkdir -p /go/src/k8s.io
|
||||
WORKDIR /go/src/k8s.io
|
||||
RUN git config --global advice.detachedHead false
|
||||
RUN git clone -b kubernetes-1.15.3 https://github.com/kubernetes/code-generator
|
||||
RUN git clone -b kubernetes-1.15.3 https://github.com/kubernetes/apimachinery
|
||||
# vendor code-generator go modules to be compatible with pre-1.15
|
||||
WORKDIR /go/src/k8s.io/code-generator
|
||||
# Don't use ENV here because we don't want to disable modules for subsequent commands
|
||||
RUN GO111MODULE=on go mod vendor
|
||||
RUN go get -d sigs.k8s.io/controller-tools/cmd/controller-gen
|
||||
WORKDIR /go/src/sigs.k8s.io/controller-tools
|
||||
RUN GO111MODULE=on go mod vendor
|
||||
RUN go get golang.org/x/tools/cmd/goimports
|
||||
WORKDIR /go/src/golang.org/x/tools
|
||||
RUN git checkout 40a48ad93fbe707101afb2099b738471f70594ec
|
||||
RUN go install ./cmd/goimports
|
||||
RUN echo chmod -R a+w /go
|
||||
WORKDIR /root
|
||||
RUN apt-get update && apt-get install -y unzip
|
||||
RUN wget --quiet https://github.com/protocolbuffers/protobuf/releases/download/v3.9.1/protoc-3.9.1-linux-x86_64.zip && \
|
||||
unzip protoc-3.9.1-linux-x86_64.zip && \
|
||||
mv bin/protoc /usr/bin/protoc && \
|
||||
chmod +x /usr/bin/protoc && \
|
||||
# download & install protoc-gen-go plugin (v1.0.0)
|
||||
mkdir -p /go/src/github.com/golang && \
|
||||
cd /go/src/github.com/golang && \
|
||||
git config --global advice.detachedHead false && \
|
||||
git clone -b v1.0.0 https://github.com/golang/protobuf && \
|
||||
cd /go/src/github.com/golang/protobuf && \
|
||||
go install ./protoc-gen-go
|
||||
chmod +x /usr/bin/protoc
|
||||
RUN mkdir -p /go/src/github.com/golang
|
||||
WORKDIR /go/src/github.com/golang
|
||||
RUN git clone -b v1.0.0 https://github.com/golang/protobuf
|
||||
WORKDIR /go/src/github.com/golang/protobuf
|
||||
RUN go install ./protoc-gen-go
|
||||
|
||||
Reference in New Issue
Block a user