FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=5ae09894bc60a23a1f9072c095414cd7fc77a6f3 SOURCE_DATE_EPOCH=1568823482 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/cluster-kube-apiserver-operator SOURCE_GIT_TAG=5ae09894 BUILD_RELEASE=201910101614
WORKDIR /go/src/github.com/openshift/cluster-kube-apiserver-operator
COPY . .
ENV GO_PACKAGE github.com/openshift/cluster-kube-apiserver-operator
RUN go build -ldflags "-X $GO_PACKAGE/pkg/version.versionFromGit=$(git describe --long --tags --abbrev=7 --match 'v[0-9]*')" ./cmd/cluster-kube-apiserver-operator

FROM openshift/ose-base:v4.2.0.20191010.161456
ENV SOURCE_GIT_COMMIT=5ae09894bc60a23a1f9072c095414cd7fc77a6f3 SOURCE_DATE_EPOCH=1568823482 BUILD_VERSION=v4.2.0 SOURCE_GIT_URL=https://github.com/openshift/cluster-kube-apiserver-operator SOURCE_GIT_TAG=5ae09894 BUILD_RELEASE=201910101614
RUN mkdir -p /usr/share/bootkube/manifests
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/bindata/bootkube/* /usr/share/bootkube/manifests/
COPY --from=builder /go/src/github.com/openshift/cluster-kube-apiserver-operator/cluster-kube-apiserver-operator /usr/bin/
COPY manifests/*.yaml /manifests
COPY manifests/image-references /manifests
# FIXME: entrypoint shouldn't be bash but the binary (needs fixing the chain)
# ENTRYPOINT ["/usr/bin/cluster-kube-apiserver-operator"]

LABEL \
        com.redhat.component="ose-cluster-kube-apiserver-operator-container" \
        name="openshift/ose-cluster-kube-apiserver-operator" \
        io.openshift.build.source-location="https://github.com/openshift/cluster-kube-apiserver-operator" \
        io.openshift.release.operator="true" \
        io.openshift.build.commit.url="https://github.com/openshift/cluster-kube-apiserver-operator/commit/5ae09894bc60a23a1f9072c095414cd7fc77a6f3" \
        version="v4.2.0" \
        io.openshift.build.commit.id="5ae09894bc60a23a1f9072c095414cd7fc77a6f3" \
        release="201910101614"

