mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
676d14688c
Run code auto-generation inside a container instead of the host system. Our auto-generation depends on specific versions of a multitude of tools (like k8s code-generator, controller-gen, protoc, mockery etc). This made it really awkward (and error-prone) to run in the host environment, especially if/when you needed different versions of those tools for other projects. Making it even more unwieldy, the required versions of tools were not neatly documented anywhere (except for git commits, perhaps). With this patch we have a "fixed environment", as we build a special auto-generate-builder container which has correct versions of all the dependencies. Using the container makes auto-generation easy to run anywhere, independent of the host system, giving reproducibility and reliability. Also, the patch moves the auto-generation steps out from the makefile into a separate script, making the makefile cleaner and the script easier to maintain.
22 lines
921 B
Text
22 lines
921 B
Text
FROM golang:1.18-buster as builder
|
|
|
|
# Install tools
|
|
RUN go install github.com/vektra/mockery@v1.0.0 && \
|
|
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0 && \
|
|
git clone https://github.com/kubernetes/code-generator -b v0.20.7 --depth 1 && \
|
|
go install k8s.io/code-generator/cmd/...@v0.20.7 && \
|
|
go install golang.org/x/tools/cmd/goimports@v0.1.1 && \
|
|
go install github.com/golang/protobuf/protoc-gen-go@v1.4.3
|
|
|
|
RUN apt-get update && apt-get install unzip
|
|
|
|
RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protoc-3.17.3-linux-x86_64.zip && \
|
|
unzip protoc-3.17.3-linux-x86_64.zip -d /usr/local && \
|
|
rm protoc-3.17.3-linux-x86_64.zip && \
|
|
chmod a+x /usr/local/bin/protoc && \
|
|
find /usr/local -type d | xargs chmod 755 && \
|
|
find /usr/local -type f | xargs chmod a+r
|
|
|
|
|
|
# Expect to be working with nfd
|
|
WORKDIR /go/node-feature-discovery
|