Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Dockerfile of clusterctl #305

Merged
merged 1 commit into from
Apr 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ generate: manifests
manifests:
go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go crd

images: openstack-cluster-api-controller manifests
images: openstack-cluster-api-controller clusterctl-image manifests

openstack-cluster-api-controller: depend manager manifests
ifeq ($(GOOS),linux)
Expand All @@ -145,10 +145,14 @@ else
$(error Please set GOOS=linux for building the image)
endif

clusterctl-image: generate fmt vet manifests
docker build . -f cmd/clusterctl/Dockerfile -t "$(REGISTRY)/openstack-cluster-api-clusterctl:$(VERSION)"

upload-images: images
hchenxa marked this conversation as resolved.
Show resolved Hide resolved
@echo "push images to $(REGISTRY)"
docker login -u="$(DOCKER_USERNAME)" -p="$(DOCKER_PASSWORD)";
docker push $(REGISTRY)/openstack-cluster-api-controller:$(VERSION)
docker push $(REGISTRY)/openstack-cluster-api-clusterctl:$(VERSION)

version:
@echo ${VERSION}
Expand Down
32 changes: 32 additions & 0 deletions cmd/clusterctl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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.

# Build the cluster binary
FROM golang:1.10.3 as builder

# Copy in the go src
WORKDIR /go/src/sigs.k8s.io/cluster-api-provider-openstack
COPY pkg/ pkg/
COPY cmd/ cmd/
COPY vendor/ vendor/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o clusterctl sigs.k8s.io/cluster-api-provider-openstack/cmd/clusterctl

# Copy clusterctl into a thin image
FROM debian:stretch-slim
WORKDIR /root/

RUN apt-get update && apt-get install -y ca-certificates openssh-client

COPY --from=builder /go/src/sigs.k8s.io/cluster-api-provider-openstack/clusterctl .
ENTRYPOINT ["./clusterctl"]