ARG BUILD_DIR=/tmp/github.com/redhat-developer/service-binding-operator

#@follow_tag(rhel8/go-toolset:1.15)
FROM rhel8/go-toolset:1.15 AS builder

USER root

ARG BUILD_DIR

WORKDIR $BUILD_DIR

# TODO: Use a RUN command to copy over specific files/dirs in a different PR
# Collapsing it into a single COPY to reduce layers, as of now.
COPY service-binding-operator-4ebb1a2abd037bd235845f65f5a3e06b5e72fc00.tar.gz .

RUN tar xf service-binding-operator-4ebb1a2abd037bd235845f65f5a3e06b5e72fc00.tar.gz --strip-components=1 && rm service-binding-operator-4ebb1a2abd037bd235845f65f5a3e06b5e72fc00.tar.gz

RUN make build


#--------------------------------------------------------------------

#@follow_tag(ubi8-minimal:8-released)
FROM ubi8-minimal:8.3

ARG BUILD_DIR

WORKDIR /
COPY --from=builder $BUILD_DIR/bin/manager .

USER 10001

ENTRYPOINT ["/manager"]

LABEL com.redhat.component="service-binding-operator-container" \
	name="ocp-tools-4-tech-preview/service-binding-rhel8-operator" \
	description="Service Binding Operator" \
	summary="Service Binding Operator" \
	io.openshift.tags="service,binding" \
	maintainer="service-binding-support@redhat.com" \
	version="v0.5.0" \
    io.k8s.display-name="The Service Binding Operator" \
    io.openshift.build.source-location="https://github.com/redhat-developer/service-binding-operator" \
    io.openshift.build.commit.url="https://github.com/redhat-developer/service-binding-operator/commit/4ebb1a2abd037bd235845f65f5a3e06b5e72fc00" \
    io.openshift.build.commit.id="4ebb1a2abd037bd235845f65f5a3e06b5e72fc00"
