FROM rhscl/ruby-25-rhel7:2.5-70.1596049320

LABEL summary="The 3scale command line interface" \
      description="3scale toolbox is a set of tools to help you manage your 3scale product" \
      io.k8s.description="3scale toolbox is a set of tools to help you manage your 3scale product" \
      io.k8s.display-name="3scale Toolbox" \
      io.openshift.expose-services="" \
      io.openshift.tags="3scale, cli, toolbox, openapi, rubygems, rhamp"

# Labels consumed by Red Hat build service
LABEL com.redhat.component="3scale-toolbox-container" \
      name="3scale-amp2/3scale-toolbox-rhel7" \
    version="1.4.0"\
      maintainer="eastizle@redhat.com"

ENV BASH_ENV=/opt/app-root/etc/scl_enable \
   ENV=/opt/app-root/etc/scl_enable \
   PROMPT_COMMAND=". /opt/app-root/etc/scl_enable" \
   BUNDLE_WITHOUT=development:test \
   TZ=:/etc/localtime \
   BUNDLE_GEMFILE=Gemfile \
   DISABLE_SPRING=1 \
   GEMS_REPO=https://origin-repository.jboss.org/nexus/content/groups/rubygems_store/

USER root

WORKDIR /opt/toolbox

ADD toolbox-*.tar.gz /tmp

RUN cd /tmp/toolbox-* && cd /opt/toolbox \
    && cp -pR /tmp/toolbox-*/* .

RUN mkdir -p /root/licenses/3scale-toolbox-container \
    && cd /opt/toolbox \
    && cp ./licenses.xml /root/licenses/3scale-toolbox-container/licenses.xml

RUN cd /opt/toolbox \
    && source /opt/app-root/etc/scl_enable \
    && bundle config --local silence_root_warning 1 \
    && bundle config --local disable_shared_gems 1 \
    && bundle config --local without development:test \
    && bundle config --local gemfile Gemfile \
    && bundle config mirror.http://rubygems.org ${GEMS_REPO}\
    && bundle config mirror.https://rubygems.org ${GEMS_REPO}

RUN source /opt/app-root/etc/scl_enable \
    && cd /opt/toolbox/ \
    && bundle install --deployment --binstubs

RUN rm -rf /tmp/toolbox-*

ADD 3scale_toolbox_entrypoint /usr/local/bin/3scale

USER 1001

CMD ["/bin/bash"]
