Use Makefile to download tools in Docker image
Relates to apache/solr-operator#491
diff --git a/Makefile b/Makefile
index 09728af..ccb437e 100644
--- a/Makefile
+++ b/Makefile
@@ -120,6 +120,7 @@
fmt: ## Run go fmt against code.
go fmt ./...
+# Ignore non-Go code warnings when it is supported natively: https://github.com/google/go-licenses/issues/120
fetch-licenses-list: mod-tidy go-licenses ## Fetch the list of license types
$(GO_LICENSES) report . --ignore github.com/apache/solr-operator | sort > dependency_licenses.csv
diff --git a/build/Dockerfile b/build/Dockerfile
index ca83eb0..bc916c5 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -16,10 +16,6 @@
WORKDIR /workspace
ARG GO111MODULE=on
-# Download necessary libraries
-RUN GOBIN=$(pwd)/bin go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.5.0; \
- GOBIN=$(pwd)/bin go install github.com/google/go-licenses@latest
-
# Copy the Go Modules manifests
COPY go.mod go.sum ./
# cache deps before building and copying source so that we don't need to re-download as much
@@ -28,7 +24,6 @@
# Copy development resources
COPY .git/ .git/
-COPY hack/ hack/
COPY build/build.sh build/build.sh
COPY Makefile LICENSE NOTICE build/LICENSE-ADDITION build/NOTICE-ADDITION ./
@@ -38,7 +33,11 @@
echo "\n\n" >> NOTICE; \
cat NOTICE-ADDITION >> NOTICE
-# Copy the go source
+# Download necessary libraries
+RUN make controller-gen go-licenses
+
+# Copy the go source and utilities
+COPY hack/ hack/
COPY main.go ./
COPY version/ version/
COPY api/ api/