# Copyright 2021 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------
#
FROM registry.redhat.io/ubi8/ubi-minimal

# Environment variables
ENV \
    AMQ_HOME="/opt/interconnect" \
    JBOSS_IMAGE_NAME="interconnect-dev-preview/qdr-rhel8" \
    JBOSS_IMAGE_VERSION="2.0.0"

# Labels
LABEL \
      com.redhat.component="interconnect-qdr-openshift-container"  \
      description="Interconnect Router container image"  \
      io.k8s.description="A lightweight AMQP message router for building scalable, available, and performant messaging networks"  \
      io.k8s.display-name="Interconnect Router"  \
      io.openshift.expose-services="5672:amqp,5671:amqps,8672:http"  \
      io.openshift.tags="messaging,amq,integration"  \
      maintainer="Mike Cressman <mcressma@redhat.com>"  \
      name="interconnect-dev-preview/qdr-rhel8"  \
      summary="Interconnect Router container image"  \
      version="2.0.0"

# Exposed ports
EXPOSE 5672 5671 55672 8672

USER root

# Add scripts used to configure the image
COPY modules /tmp/scripts

# Install findutils, because find is used by the add-debug-repo script
RUN microdnf install -y findutils && microdnf clean all && rm -rf /var/cache/yum

# run a workaround to allow the debuginfo for the latest qpid-dispatch build to be available
RUN [ "bash", "-x", "/tmp/scripts/add-debug-repo.sh" ]

# Install required RPMs

# troubleshooting-related
RUN microdnf install -y gdb iputils net-tools gettext hostname valgrind && microdnf clean all && rm -rf /var/cache/yum
RUN microdnf install -y cyrus-sasl-gssapi cyrus-sasl-plain cyrus-sasl-md5 cyrus-sasl-scram && microdnf clean all && rm -rf /var/cache/yum
RUN microdnf install -y qpid-dispatch-router qpid-dispatch-tools qpid-dispatch-console qpid-dispatch-router-debuginfo && microdnf clean all && rm -rf /var/cache/yum
#RUN rpm -q cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain cyrus-sasl-scram qpid-dispatch-router qpid-dispatch-tools qpid-dispatch-console libwebsockets qpid-proton

# Custom scripts
USER root
RUN [ "bash", "-x", "/tmp/scripts/interconnect.config/install.sh" ]

USER root
RUN [ "bash", "-x", "/tmp/scripts/interconnect.launch/install.sh" ]

USER root
RUN rm -rf /tmp/scripts

USER 185



CMD ["/opt/interconnect/bin/launch.sh"]

