FROM openshift/golang-builder:1.12 AS builder
ENV SOURCE_GIT_COMMIT=9741cf15610065b20a1d8322e425e400380f8cbf SOURCE_GIT_TAG=9741cf15 SOURCE_GIT_URL=https://github.com/openshift/cluster-kube-apiserver-operator SOURCE_DATE_EPOCH=1575945822 BUILD_VERSION=v4.2.18 BUILD_RELEASE=202002031246
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.18.20200203.124646
ENV SOURCE_GIT_COMMIT=9741cf15610065b20a1d8322e425e400380f8cbf SOURCE_GIT_TAG=9741cf15 SOURCE_GIT_URL=https://github.com/openshift/cluster-kube-apiserver-operator SOURCE_DATE_EPOCH=1575945822 BUILD_VERSION=v4.2.18 BUILD_RELEASE=202002031246
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 \
        io.openshift.release.operator="true" \
        name="openshift/ose-cluster-kube-apiserver-operator" \
        com.redhat.component="ose-cluster-kube-apiserver-operator-container" \
        version="v4.2.18" \
        release="202002031246" \
        io.openshift.build.commit.id="9741cf15610065b20a1d8322e425e400380f8cbf" \
        io.openshift.build.source-location="https://github.com/openshift/cluster-kube-apiserver-operator" \
        io.openshift.build.commit.url="https://github.com/openshift/cluster-kube-apiserver-operator/commit/9741cf15610065b20a1d8322e425e400380f8cbf"

