#
# Dockerfile for building local images.
#

# Build the manager binary
FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=835d9b25e076b4f058bf638a6fe61d622086d78d SOURCE_DATE_EPOCH=1576118567 BUILD_VERSION=v4.3.0 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_GIT_TAG=835d9b25 BUILD_RELEASE=202001211731

# Copy in the go src
WORKDIR /go/src/github.com/openshift/cloud-credential-operator
COPY pkg/    pkg/
COPY cmd/    cmd/
COPY vendor/ vendor/
COPY version/ version/

# Build
RUN CGO_ENABLED=0 GOOS=linux go build -a -o manager github.com/openshift/cloud-credential-operator/cmd/manager

# Copy the controller-manager into a thin image
FROM openshift/ose-base:v4.3.0.20200121.173126
ENV SOURCE_GIT_COMMIT=835d9b25e076b4f058bf638a6fe61d622086d78d SOURCE_DATE_EPOCH=1576118567 BUILD_VERSION=v4.3.0 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_GIT_TAG=835d9b25 BUILD_RELEASE=202001211731
WORKDIR /root/
COPY --from=builder /go/src/github.com/openshift/cloud-credential-operator/manager .
ADD manifests/ /manifests

ENTRYPOINT ["./manager"]

LABEL \
        com.redhat.component="ose-cloud-credential-operator-container" \
        name="openshift/ose-cloud-credential-operator" \
        io.openshift.build.source-location="https://github.com/openshift/cloud-credential-operator" \
        io.openshift.release.operator="true" \
        io.openshift.build.commit.url="https://github.com/openshift/cloud-credential-operator/commit/835d9b25e076b4f058bf638a6fe61d622086d78d" \
        version="v4.3.0" \
        io.openshift.build.commit.id="835d9b25e076b4f058bf638a6fe61d622086d78d" \
        release="202001211731"

