#
# Dockerfile for building local images.
#

# Build the manager binary
FROM openshift/golang-builder:1.10 AS builder
ENV SOURCE_GIT_COMMIT=ec6f38d73a7921e79d0ca7555da3a864e808e681 SOURCE_DATE_EPOCH=1565648947 BUILD_VERSION=v4.1.16 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_GIT_TAG=ec6f38d BUILD_RELEASE=201909100604

# 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.1.16.20190910.060423
ENV SOURCE_GIT_COMMIT=ec6f38d73a7921e79d0ca7555da3a864e808e681 SOURCE_DATE_EPOCH=1565648947 BUILD_VERSION=v4.1.16 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_GIT_TAG=ec6f38d BUILD_RELEASE=201909100604
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/ec6f38d73a7921e79d0ca7555da3a864e808e681" \
        version="v4.1.16" \
        io.openshift.build.commit.id="ec6f38d73a7921e79d0ca7555da3a864e808e681" \
        release="201909100604"

