# Copyright 2017 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.
#
# ------------------------------------------------------------------------
#
# This is a Dockerfile for the rhpam-7-tech-preview/rhpam70-businesscentral-indexing:7.0.0 image.

FROM jboss/openjdk18-rhel7:1.1

# Environment variables
ENV \
    ELASTICSEARCH_DISTRIBUTION_ZIP="elasticsearch-5.6.5.zip" \
    ELASTICSEARCH_HOME="/opt/elasticsearch" \
    ELASTICSEARCH_VERSION="5.6.5" \
    JBOSS_IMAGE_NAME="rhpam-7-tech-preview/rhpam70-businesscentral-indexing" \
    JBOSS_IMAGE_VERSION="7.0.0" \
    JBOSS_PRODUCT="rhpam-businesscentral-indexing" \
    PRODUCT_VERSION="7.0.0" \
    RHPAM_BUSINESS_CENTRAL_INDEXING_VERSION="7.0.0" 

# Labels
LABEL \
      architecture="x86_64"  \
      com.redhat.component="rhpam-7-rhpam70-businesscentral-indexing-container"  \
      description="Red Hat Business Central Indexing 7.0 Container Image"  \
      elasticsearch.version="5.6.5"  \
      io.cekit.version="2.0.0rc4"  \
      name="rhpam-7-tech-preview/rhpam70-businesscentral-indexing"  \
      org.concrt.version="2.0.0rc4"  \
      org.jboss.product="rhpam-businesscentral-indexing"  \
      org.jboss.product.rhpam-businesscentral-indexing.version="7.0.0"  \
      org.jboss.product.version="7.0.0"  \
      summary="Red Hat Business Central Indexing 7.0 Container Image"  \
      version="7.0.0" 


USER root

# Add custom repo files
COPY \  
    repos/jboss-os.repo \
 
    repos/jboss-rhscl.repo \
    /etc/yum.repos.d/


# Install required RPMs and ensure that the packages were installed
RUN yum install -y hostname \
    && yum clean all && rm -rf /var/cache/yum && \
    rpm -q  hostname
# Remove custom repo files
RUN rm /etc/yum.repos.d/jboss-os.repo /etc/yum.repos.d/jboss-rhscl.repo

# Add all artifacts to the /tmp/artifacts
# directory
COPY \
    elasticsearch-5.6.5.zip \
    /tmp/artifacts/

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

# Custom scripts
USER root
RUN [ "bash", "-x", "/tmp/scripts/businesscentral-indexing/install" ]

USER root
RUN rm -rf /tmp/scripts
USER root
RUN rm -rf /tmp/artifacts

USER 185



CMD ["/opt/elasticsearch/bin/elasticsearch"]
