FROM rhel7:7.2
MAINTAINER Red Hat, Inc.

LABEL BZComponent="devtoolset-6-perftools-docker"
LABEL Name="rhscl-beta/devtoolset-6-perftools-rhel7"
LABEL Version="6"
LABEL Release="4"
LABEL Architecture="x86_64"
LABEL io.k8s.description="Performance tools: systemtap, valgrind, dyninst, elfutils, oprofile"
LABEL io.k8s.display-name="Developer Toolset 6 Performance Tools"
LABEL io.k8s.min-memory="2Gi"

RUN yum-config-manager --enable rhel-server-rhscl-beta-7-rpms && \
    yum-config-manager --enable rhel-7-server-optional-rpms && \
    yum-config-manager --disable epel >/dev/null || : && \
    yum install -y --setopt=tsflags=nodocs devtoolset-6-systemtap devtoolset-6-valgrind devtoolset-6-dyninst devtoolset-6-dyninst-devel devtoolset-6-elfutils devtoolset-6-elfutils-devel devtoolset-6-oprofile devtoolset-6-oprofile-jit devtoolset-6-oprofile-devel && \
    yum clean all -y

# Each language image can have 'contrib' a directory with extra files needed to
# run and build the applications.
COPY ./contrib/ /root

ENV HOME=/root \
    PATH=/root/bin:/opt/rh/devtoolset-6/root/usr/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

RUN mkdir -p ${HOME} && \
    chmod u+x /root/bin/usage

USER 0

WORKDIR ${HOME}

ADD contrib/etc/scl_enable /root/etc/scl_enable

# Enable the SCL for all bash scripts.
ENV BASH_ENV=/root/etc/scl_enable \
    ENV=/root/etc/scl_enable \
    PROMPT_COMMAND=". /root/etc/scl_enable"

# Set the default CMD to print the usage of the perftools image
ENTRYPOINT ["container-entrypoint"]
CMD ["usage"]
