
# This is a Dockerfile for the rhi-operator:1.0 image.

## START builder image setup:1.0
## \  
    FROM registry.redhat.io/ubi8/go-toolset AS setup

    USER root

###### START module 'setup:1.0'
###### \
        # Copy 'setup' module content
        COPY modules/setup /tmp/scripts/setup
        # Custom scripts from 'setup' module
        USER root
        RUN [ "sh", "-x", "/tmp/scripts/setup/setup.sh" ]
###### /
###### END module 'setup:1.0'

###### START image 'setup:1.0'
###### \
        # Set 'setup' image defined environment variables
        ENV \
            JBOSS_IMAGE_NAME="rhi-operator" \
            JBOSS_IMAGE_VERSION="1.0" 
        # Set 'setup' image defined labels
        LABEL \
            name="rhi-operator"  \
            version="1.0" 
###### /
###### END image 'setup:1.0'

## /
## END builder image


## START target image rhi-operator:1.0
## \
    FROM registry.redhat.io/ubi8/ubi

    USER root

###### START module 'build:1.0'
###### \
        # Copy 'build' module stage artifacts
        COPY --from=setup /workspace/manager //manager
        COPY --from=setup /workspace/licenses //licenses
        # Copy 'build' module content
        COPY modules/build /tmp/scripts/build
        # Custom scripts from 'build' module
        USER root
        RUN [ "sh", "-x", "/tmp/scripts/build/create-user.sh" ]
###### /
###### END module 'build:1.0'

###### START image 'rhi-operator:1.0'
###### \
        # Set 'rhi-operator' image defined environment variables
        ENV \
            JBOSS_IMAGE_NAME="rhi-operator" \
            JBOSS_IMAGE_VERSION="1.0" 
        # Set 'rhi-operator' image defined labels
        LABEL \
            com.redhat.component="rhi-operator-container"  \
            io.cekit.version="3.8.0"  \
            io.k8s.description="Red Hat® Integration is a comprehensive set of integration and messaging technologies to connect applications and data across hy\
brid infrastructures. The Red Hat® Integration operator will install underling components across Data, API Management, Messaging\
 and Enterprise Integration Patterns.\
"  \
            io.k8s.display-name="Red Hat Integration Operator"  \
            io.openshift.tags="integration"  \
            maintainer="Alexandre B. Kieling <abrianik@redhat.com>"  \
            name="rhi-operator"  \
            version="1.0" 
###### /
###### END image 'rhi-operator:1.0'


    # Switch to 'root' user and remove artifacts and modules
    USER root
    RUN [ ! -d /tmp/scripts ] || rm -rf /tmp/scripts
    RUN [ ! -d /tmp/artifacts ] || rm -rf /tmp/artifacts
    # Define the user
    USER 185
    # Define entrypoint
    ENTRYPOINT ["/manager"]
## /
## END target image

