FROM registry.fedoraproject.org/f25/s2i-base:latest

# This image provides a Ruby 2.4 environment you can use to run your Ruby
# applications.

LABEL MAINTAINER SoftwareCollections.org <sclorg@redhat.com>

EXPOSE 8080

ENV RUBY_VERSION 2.4

LABEL summary="Platform for building and running Ruby 2.4 applications" \
      io.k8s.description="Platform for building and running Ruby 2.4 applications" \
      io.k8s.display-name="Ruby 2.4" \
      io.openshift.expose-services="8080:http" \
      io.openshift.tags="builder,ruby,ruby24,rh-ruby24"

ENV NAME=ruby VERSION=0 RELEASE=12 ARCH=x86_64

LABEL com.redhat.component="$NAME" \
      name="$FGC/$NAME" \
      version="$VERSION" \
      eelease="$RELEASE.$DISTTAG" \
      architecture="$ARCH" \
      usage="s2i build file:///your/app 25/ruby your-app" \
      help="help.1"

RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler nodejs" && \
    dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && rpm -V $INSTALL_PKGS && \
    dnf clean all -y

# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH
COPY ./s2i/bin/ $STI_SCRIPTS_PATH

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

RUN chown -R 1001:0 /opt/app-root && chmod -R ug+rwx /opt/app-root

USER 1001

# Set the default CMD to print the usage of the language image
CMD $STI_SCRIPTS_PATH/usage
