| # Build the manager binary |
| FROM golang:1.13 as builder |
| |
| WORKDIR /workspace |
| ARG GO111MODULE=on |
| |
| # Download necessary libraries |
| RUN go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.2 |
| |
| # Copy the Go Modules manifests |
| COPY go.mod go.mod |
| COPY go.sum go.sum |
| # cache deps before building and copying source so that we don't need to re-download as much |
| # and so that source changes don't invalidate our downloaded layer |
| RUN go mod download |
| |
| # Copy development resources |
| COPY .git/ .git/ |
| COPY hack/ hack/ |
| COPY build/build.sh build/build.sh |
| COPY Makefile ./ |
| |
| # Copy the go source |
| COPY main.go ./ |
| COPY api/ api/ |
| COPY controllers/ controllers/ |
| |
| ARG VERSION |
| ARG GIT_SHA |
| |
| # Build |
| RUN CGO_ENABLED=0 make build |