diff --git a/Dockerfile b/Dockerfile index d88b12a94d..45c288b63a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,34 +1,15 @@ -# 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. - -# Reproducible builder image -FROM openshift/origin-release:golang-1.10 as builder - -# Workaround a bug in imagebuilder (some versions) where this dir will not be auto-created. -RUN mkdir -p /go/src/sigs.k8s.io/cluster-api-provider-openstack +FROM registry.svc.ci.openshift.org/openshift/release:golang-1.10 AS builder WORKDIR /go/src/sigs.k8s.io/cluster-api-provider-openstack - -# This expects that the context passed to the docker build command is -# the cluster-api-provider-openstack directory. -# e.g. docker build -t -f COPY . . - -RUN GOPATH="/go" CGO_ENABLED=0 GOOS=linux go install -ldflags '-extldflags "-static"' sigs.k8s.io/cluster-api-provider-openstack/cmd/machine-controller -RUN GOPATH="/go" CGO_ENABLED=0 GOOS=linux go install -ldflags '-extldflags "-static"' sigs.k8s.io/cluster-api-provider-openstack/vendor/sigs.k8s.io/cluster-api/cmd/controller-manager - -# Final container -FROM openshift/origin-base -RUN yum install -y ca-certificates openssh - -COPY --from=builder /go/bin/machine-controller /go/bin/controller-manager . +RUN go build ./cmd/machine-controller +RUN go build ./vendor/sigs.k8s.io/cluster-api/cmd/controller-manager + +FROM registry.svc.ci.openshift.org/openshift/origin-v4.0:base +RUN INSTALL_PKGS=" \ + openssh \ + " && \ + yum install -y $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + yum clean all +COPY --from=builder /go/src/sigs.k8s.io/cluster-api-provider-openstack/machine-controller / +COPY --from=builder /go/src/sigs.k8s.io/cluster-api-provider-openstack/controller-manager / diff --git a/Dockerfile.rhel7 b/Dockerfile.rhel7 new file mode 100644 index 0000000000..08a7afb997 --- /dev/null +++ b/Dockerfile.rhel7 @@ -0,0 +1,15 @@ +FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.10 AS builder +WORKDIR /go/src/sigs.k8s.io/cluster-api-provider-openstack +COPY . . +RUN go build ./cmd/machine-controller +RUN go build ./vendor/sigs.k8s.io/cluster-api/cmd/controller-manager + +FROM registry.svc.ci.openshift.org/ocp/4.0:base +RUN INSTALL_PKGS=" \ + openssh \ + " && \ + yum install -y $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + yum clean all +COPY --from=builder /go/src/sigs.k8s.io/cluster-api-provider-openstack/machine-controller / +COPY --from=builder /go/src/sigs.k8s.io/cluster-api-provider-openstack/controller-manager /