|
| 1 | +# Copyright 2019 The Kubernetes Authors. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# Build the manager binary |
| 16 | +FROM golang:1.12.7 |
| 17 | + |
| 18 | +# default the go proxy |
| 19 | +ARG goproxy=https://proxy.golang.org |
| 20 | + |
| 21 | +# run this with docker build --build_arg $(go env GOPROXY) to override the goproxy |
| 22 | +ENV GOPROXY=$goproxy |
| 23 | + |
| 24 | +WORKDIR /workspace |
| 25 | +COPY go.mod go.mod |
| 26 | +COPY go.sum go.sum |
| 27 | +# cache deps before building and copying source so that we don't need to re-download as much |
| 28 | +# and so that source changes don't invalidate our downloaded layer |
| 29 | +RUN go mod download |
| 30 | + |
| 31 | +# Copy the go source |
| 32 | +COPY main.go main.go |
| 33 | +COPY api/ api/ |
| 34 | +COPY controllers/ controllers/ |
| 35 | +COPY kubeadm/ kubeadm/ |
| 36 | +COPY cloudinit/ cloudinit/ |
| 37 | +COPY certs/ certs/ |
| 38 | + |
| 39 | +# Allow containerd to restart pods by calling /restart.sh (mostly for tilt + fast dev cycles) |
| 40 | +# TODO: Remove this on prod and use a multi-stage build |
| 41 | +COPY third_party/forked/rerun-process-wrapper/start.sh . |
| 42 | +COPY third_party/forked/rerun-process-wrapper/restart.sh . |
| 43 | + |
| 44 | +# Build and run |
| 45 | +RUN go install -v . |
| 46 | +RUN mv /go/bin/cluster-api-bootstrap-provider-kubeadm /manager |
| 47 | +ENTRYPOINT ["./start.sh", "/manager"] |
0 commit comments