|
| 1 | +FROM quay.io/sclorg/s2i-base-c8s:c8s |
| 2 | + |
| 3 | +# This image provides a Ruby environment you can use to run your Ruby |
| 4 | +# applications. |
| 5 | + |
| 6 | +EXPOSE 8080 |
| 7 | + |
| 8 | +ENV RUBY_MAJOR_VERSION=3 \ |
| 9 | + RUBY_MINOR_VERSION=3 |
| 10 | + |
| 11 | +ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ |
| 12 | + RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" |
| 13 | + |
| 14 | +ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ |
| 15 | + IMAGE_NAME="ubi8/ruby-${RUBY_SCL_NAME_VERSION}" \ |
| 16 | + SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ |
| 17 | + DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ |
| 18 | +building and running various Ruby $RUBY_VERSION applications and frameworks. \ |
| 19 | +Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ |
| 20 | +It has many features to process text files and to do system management tasks (as in Perl). \ |
| 21 | +It is simple, straight-forward, and extensible." |
| 22 | + |
| 23 | +LABEL summary="$SUMMARY" \ |
| 24 | + description="$DESCRIPTION" \ |
| 25 | + io.k8s.description="$DESCRIPTION" \ |
| 26 | + io.k8s.display-name="Ruby ${RUBY_VERSION}" \ |
| 27 | + io.openshift.expose-services="8080:http" \ |
| 28 | + io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ |
| 29 | + com.redhat.component="${RUBY_SCL}-container" \ |
| 30 | + name="${IMAGE_NAME}" \ |
| 31 | + version="1" \ |
| 32 | + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ |
| 33 | + usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ |
| 34 | +--context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ |
| 35 | + maintainer="SoftwareCollections.org < [email protected]>" |
| 36 | + |
| 37 | +RUN yum -y module enable ruby:$RUBY_VERSION && \ |
| 38 | + INSTALL_PKGS=" \ |
| 39 | + libffi-devel \ |
| 40 | + ruby \ |
| 41 | + ruby-devel \ |
| 42 | + rubygem-rake \ |
| 43 | + rubygem-bundler \ |
| 44 | + ruby-bundled-gems \ |
| 45 | + redhat-rpm-config \ |
| 46 | + " && \ |
| 47 | + yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ |
| 48 | + yum reinstall -y --setopt=tsflags=nodocs tzdata && \ |
| 49 | + yum -y clean all --enablerepo='*' && \ |
| 50 | + ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ |
| 51 | + rpm -V ${INSTALL_PKGS} |
| 52 | + |
| 53 | +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH |
| 54 | +COPY ./s2i/bin/ $STI_SCRIPTS_PATH |
| 55 | + |
| 56 | +# Copy extra files to the image. |
| 57 | +COPY ./root/ / |
| 58 | + |
| 59 | +# Drop the root user and make the content of /opt/app-root owned by user 1001 |
| 60 | +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ |
| 61 | + rpm-file-permissions |
| 62 | + |
| 63 | +USER 1001 |
| 64 | + |
| 65 | +# Set the default CMD to print the usage of the language image |
| 66 | +CMD $STI_SCRIPTS_PATH/usage |
0 commit comments