|
| 1 | +# Instructions to install API using the installer |
| 2 | +# Build and test the controller-manager |
| 3 | +FROM golang:1.9.3 as builder |
| 4 | + |
| 5 | +ENV TEST_ASSET_DIR /usr/local/bin |
| 6 | +ENV TEST_ASSET_KUBECTL $TEST_ASSET_DIR/kubectl |
| 7 | +ENV TEST_ASSET_KUBE_APISERVER $TEST_ASSET_DIR/kube-apiserver |
| 8 | +ENV TEST_ASSET_ETCD $TEST_ASSET_DIR/etcd |
| 9 | + |
| 10 | +# Download test framework binaries |
| 11 | +ENV TEST_ASSET_URL https://storage.googleapis.com/k8s-c10s-test-binaries |
| 12 | +RUN curl ${TEST_ASSET_URL}/etcd-Linux-x86_64 --output $TEST_ASSET_ETCD |
| 13 | +RUN curl ${TEST_ASSET_URL}/kube-apiserver-Linux-x86_64 --output $TEST_ASSET_KUBE_APISERVER |
| 14 | +RUN curl https://storage.googleapis.com/kubernetes-release/release/v1.9.2/bin/linux/amd64/kubectl --output $TEST_ASSET_KUBECTL |
| 15 | +RUN chmod +x $TEST_ASSET_ETCD |
| 16 | +RUN chmod +x $TEST_ASSET_KUBE_APISERVER |
| 17 | +RUN chmod +x $TEST_ASSET_KUBECTL |
| 18 | + |
| 19 | +# Copy in the go src |
| 20 | +WORKDIR /go/src/github.com/kubernetes-sigs/kubebuilder/samples/memcached-api-server |
| 21 | +COPY pkg/ pkg/ |
| 22 | +COPY cmd/ cmd/ |
| 23 | +COPY vendor/ vendor/ |
| 24 | + |
| 25 | +# Build and test the API code |
| 26 | +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o controller-manager ./cmd/controller-manager/main.go |
| 27 | +RUN go test ./pkg/... ./cmd/... |
| 28 | + |
| 29 | +# Copy the controller-manager into a thin image |
| 30 | +FROM scratch |
| 31 | +# RUN apk --no-cache add ca-certificates |
| 32 | +WORKDIR /root/ |
| 33 | +COPY --from=builder /go/src/github.com/kubernetes-sigs/kubebuilder/samples/memcached-api-server/controller-manager . |
| 34 | +ENTRYPOINT ["./controller-manager"] |
| 35 | +CMD ["--install-crds=false"] |
0 commit comments