#
# Dockerfile for building local images.
#

# Build the manager binary
FROM openshift/golang-builder:1.10 AS builder
ENV SOURCE_GIT_COMMIT=f38be0e8a312c51af1c3745417d9a497295e14b4 SOURCE_DATE_EPOCH=1571966237 BUILD_VERSION=v4.1.27 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_GIT_TAG=f38be0e BUILD_RELEASE=201912030019

# 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.27.20191203.001959
ENV SOURCE_GIT_COMMIT=f38be0e8a312c51af1c3745417d9a497295e14b4 SOURCE_DATE_EPOCH=1571966237 BUILD_VERSION=v4.1.27 SOURCE_GIT_URL=https://github.com/openshift/cloud-credential-operator SOURCE_GIT_TAG=f38be0e BUILD_RELEASE=201912030019
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/f38be0e8a312c51af1c3745417d9a497295e14b4" \
        version="v4.1.27" \
        io.openshift.build.commit.id="f38be0e8a312c51af1c3745417d9a497295e14b4" \
        release="201912030019"

