FROM openshift/golang-builder:1.13 AS build-env

COPY keycloak-operator-*.tar.gz /src/

RUN cd /src && tar -x --strip-components=1 -f keycloak-operator-*.tar.gz && \
    make code/compile && \
    echo "Build SHA1: $(git rev-parse HEAD)" && \
    echo "$(git rev-parse HEAD)" > /src/BUILD_INFO

# final stage
FROM registry.redhat.io/ubi8/ubi-minimal:latest

LABEL com.redhat.component="redhat-sso-7-rhel8-operator-container"  description="Red Hat Single Sign-On 7. Operator container image, based on the Red Hat Universal Base Image 8 Minimal container image" summary="Red Hat Single Sign-On 7.5 Operator container image, based on the Red Hat Universal Base Image 8 Minimal container image" version="7.5" io.k8s.description="Operator for Red Hat SSO" io.k8s.display-name="Red Hat SSO 7.5 Operator" io.openshift.tags="sso,sso75,keycloak,operator" name="rh-sso-7/sso7-rhel8-operator" maintainer="Red Hat Single Sign-On Team"

RUN microdnf update && microdnf clean all && rm -rf /var/cache/yum/*

COPY --from=build-env /src/BUILD_INFO /src/BUILD_INFO
COPY --from=build-env /src/tmp/_output/bin/keycloak-operator /usr/local/bin

ENTRYPOINT ["/usr/local/bin/keycloak-operator"]
