diff --git a/Makefile b/Makefile index 7866e68642c..05c2e5e5afe 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,17 @@ # Image URL to use all building/pushing image targets IMG ?= controller:latest -all: test manager +all: test build # Run tests test: generate fmt vet manifests go test ./pkg/... ./cmd/... -coverprofile cover.out +# Builds all of hive's binaries (including utils). +.PHONY: build +build: manager + + # Build manager binary manager: generate fmt vet go build -o bin/manager github.com/openshift/hive/cmd/manager diff --git a/build/build-image/Dockerfile b/build/build-image/Dockerfile new file mode 100644 index 00000000000..39f16b66c77 --- /dev/null +++ b/build/build-image/Dockerfile @@ -0,0 +1,36 @@ +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM openshift/origin-release:golang-GO_VERSION + +# Install the golint, use this to check our source for niceness +RUN go get -u github.com/golang/lint/golint + +# Install gomock and mockgen for the mocks used in unit tests +RUN go get -u github.com/golang/mock/gomock +RUN go get -u github.com/golang/mock/mockgen + +# Install kubebuilder 1.0.1 TODO: ask cewong if there's a way to cache this. It takes a long time to d/l +RUN export version=1.0.1 && \ + cd /tmp && \ + curl -L -O https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${version}_linux_amd64.tar.gz && \ + tar -zxvf /tmp/kubebuilder_${version}_linux_amd64.tar.gz && \ + mv kubebuilder_${version}_linux_amd64 /usr/local/kubebuilder + + +# Create the full dir tree that we'll mount our src into when we run the image +RUN mkdir -p /go/src/github.com/openshift/hive + +# Default to our src dir +WORKDIR /go/src/github.com/openshift/hive diff --git a/build/test-image/Dockerfile b/build/test-image/Dockerfile new file mode 100644 index 00000000000..a17ae602eeb --- /dev/null +++ b/build/test-image/Dockerfile @@ -0,0 +1,25 @@ +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This image is meant to be used only for CI as a base for +# verification tests and unit tests. +# It combines the builder image (images/builder-image) and the +# hive source. + +FROM builder-base +RUN mkdir -p /go/src/github.com/openshift/hive && \ + cd /go/src/github.com/openshift/hive +WORKDIR /go/src/github.com/openshift/hive +COPY . . +RUN chmod -R og+w /go