Skip to content
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
45 changes: 13 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <tag> -f <this_Dockerfile> <path_to_cluster-api-openstack>
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 /
15 changes: 15 additions & 0 deletions Dockerfile.rhel7
Original file line number Diff line number Diff line change
@@ -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 /