#
# Dockerfile for building local images.
#

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

# 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.1.20200203.214022
ENV SOURCE_GIT_COMMIT=835d9b25e076b4f058bf638a6fe61d622086d78d SOURCE_GIT_TAG=835d9b25 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_DATE_EPOCH=1576118567 BUILD_VERSION=v4.3.1 BUILD_RELEASE=202002032140
WORKDIR /root/
COPY --from=builder /go/src/github.com/openshift/cloud-credential-operator/manager .
ADD manifests/ /manifests

ENTRYPOINT ["./manager"]

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

