#
# Dockerfile for building local images.
#

# Build the manager binary
FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=16ebd83fd5269c41983406dd11758a2601751188 SOURCE_GIT_TAG=16ebd83f SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_DATE_EPOCH=1581619822 BUILD_VERSION=v4.3.3 BUILD_RELEASE=202002171705

# 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.3.20200217.170535
ENV SOURCE_GIT_COMMIT=16ebd83fd5269c41983406dd11758a2601751188 SOURCE_GIT_TAG=16ebd83f SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_DATE_EPOCH=1581619822 BUILD_VERSION=v4.3.3 BUILD_RELEASE=202002171705
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.3" \
        release="202002171705" \
        io.openshift.build.commit.id="16ebd83fd5269c41983406dd11758a2601751188" \
        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/16ebd83fd5269c41983406dd11758a2601751188"

