From 9478be5f88960cda438e25f8ada92b3bd64a9e9f Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 31 Aug 2026 12:09:02 +0200 Subject: [PATCH 01/13] distgen: Add manifest, multispec and shared files. Instead of using .exclude* marker files we can just not generate the Dockerfiles in the first place by not having the combination in the multispec `include` section README.md: fix for section's "Building an application using a Dockerfile" numbered subsections 3.1 and 3.2. At some point, I can only assume there was an equivalent of `sed -i -e 's/3.1/3.2/g'` and equivalent for 3.2 -> 3.3 and so on until 4.0. However there was an unwanted result of the change that changed not only referenced ruby, but also the section number. Since the replace was global, the links were still correct though. Here, we bring it back to the intended numbering. multispect.yml: Use YAML anchors for generic things. These anchors can be injected into the specific sections to deduplicate common items used during generation. Assisted-by: Claude Opus 4.8 (1M context) --- 3.0/.exclude-c9s | 0 3.0/.exclude-rhel8 | 0 3.3/.exclude-c9s | 0 4.0/.exclude-c9s | 0 manifest.yml | 110 ++++++++++++++ specs/multispec.yml | 122 +++++++++++++++ src/Dockerfile.template | 79 ++++++++++ src/README.md | 232 +++++++++++++++++++++++++++++ src/root/opt/app-root/.gemrc | 9 ++ src/root/opt/app-root/etc/puma.cfg | 50 +++++++ src/s2i/bin/assemble | 84 +++++++++++ src/s2i/bin/run | 39 +++++ src/s2i/bin/usage | 18 +++ 13 files changed, 743 insertions(+) delete mode 100644 3.0/.exclude-c9s delete mode 100644 3.0/.exclude-rhel8 delete mode 100644 3.3/.exclude-c9s delete mode 100644 4.0/.exclude-c9s create mode 100644 manifest.yml create mode 100644 specs/multispec.yml create mode 100644 src/Dockerfile.template create mode 100644 src/README.md create mode 100644 src/root/opt/app-root/.gemrc create mode 100644 src/root/opt/app-root/etc/puma.cfg create mode 100644 src/s2i/bin/assemble create mode 100755 src/s2i/bin/run create mode 100755 src/s2i/bin/usage diff --git a/3.0/.exclude-c9s b/3.0/.exclude-c9s deleted file mode 100644 index e69de29b..00000000 diff --git a/3.0/.exclude-rhel8 b/3.0/.exclude-rhel8 deleted file mode 100644 index e69de29b..00000000 diff --git a/3.3/.exclude-c9s b/3.3/.exclude-c9s deleted file mode 100644 index e69de29b..00000000 diff --git a/4.0/.exclude-c9s b/4.0/.exclude-c9s deleted file mode 100644 index e69de29b..00000000 diff --git a/manifest.yml b/manifest.yml new file mode 100644 index 00000000..5eca7cce --- /dev/null +++ b/manifest.yml @@ -0,0 +1,110 @@ +# Files that rely on specific distro x version combination. +DISTGEN_MULTI_RULES: + - src: src/Dockerfile.template + dest: Dockerfile.rhel8 + - src: src/Dockerfile.template + dest: Dockerfile.rhel9 + - src: src/Dockerfile.template + dest: Dockerfile.rhel10 + - src: src/Dockerfile.template + dest: Dockerfile.c9s + - src: src/Dockerfile.template + dest: Dockerfile.c10s + - src: src/Dockerfile.template + dest: Dockerfile.fedora + +DISTGEN_RULES: + - src: src/README.md + dest: README.md + - src: src/s2i/bin/assemble + dest: s2i/bin/assemble + mode: "0755" + + # Gemfile{,.lock}: dependent per-version. + - src: src/test/puma-test-app/Gemfile + dest: test/puma-test-app/Gemfile + - src: src/test/puma-test-app/Gemfile.lock + dest: test/puma-test-app/Gemfile.lock + + - src: src/test/rack-test-app/Gemfile + dest: test/rack-test-app/Gemfile + - src: src/test/rack-test-app/Gemfile.lock + dest: test/rack-test-app/Gemfile.lock + +COPY_RULES: + - src: src/s2i/bin/run + dest: s2i/bin/run + mode: "0755" + - src: src/s2i/bin/usage + dest: s2i/bin/usage + mode: "0755" + + - src: src/root/opt/app-root/.gemrc + dest: root/opt/app-root/.gemrc + - src: src/root/opt/app-root/etc/puma.cfg + dest: root/opt/app-root/etc/puma.cfg + + - src: test/test-fips/app.rb + dest: test/test-fips/app.rb + - src: test/test-fips/config.ru + dest: test/test-fips/config.ru + - src: test/test-fips/Gemfile + dest: test/test-fips/Gemfile + + - src: test/puma-test-app/app.rb + dest: test/puma-test-app/app.rb + - src: test/puma-test-app/config.ru + dest: test/puma-test-app/config.ru + + - src: test/rack-test-app/app.rb + dest: test/rack-test-app/app.rb + - src: test/rack-test-app/config.ru + dest: test/rack-test-app/config.ru + + +SYMLINK_RULES: + # Shared test framework: link back to the repo-root test/ and common/. + - src: ../../test/conftest.py + dest: test/conftest.py + - src: ../../test/__init__.py + dest: test/__init__.py + - src: ../../examples + dest: test/examples + + + - src: ../../imagestreams + dest: test/imagestreams + - src: ../../test/run + dest: test/run + - src: ../../test/run-pytest + dest: test/run-pytest + - src: ../../test/run-openshift-pytest + dest: test/run-openshift-pytest + - src: ../../test/test_container_application.py + dest: test/test_container_application.py + - src: ../../test/test_container_basics.py + dest: test/test_container_basics.py + - src: ../../test/test_container_fips.py + dest: test/test_container_fips.py + - src: ../../test/test_ocp_helm_ruby_imagestreams.py + dest: test/test_ocp_helm_ruby_imagestreams.py + - src: ../../test/test_ocp_helm_ruby_rails_application.py + dest: test/test_ocp_helm_ruby_rails_application.py + - src: ../../test/test_ocp_ruby_ex_standalone.py + dest: test/test_ocp_ruby_ex_standalone.py + - src: ../../test/test_ocp_ruby_latest_imagestreams.py + dest: test/test_ocp_ruby_latest_imagestreams.py + - src: ../../test/test_ocp_s2i_imagestreams.py + dest: test/test_ocp_s2i_imagestreams.py + - src: ../../test/test_ocp_s2i_integration.py + dest: test/test_ocp_s2i_integration.py + - src: ../../test/test_ocp_s2i_templates.py + dest: test/test_ocp_s2i_templates.py + - src: ../../common/test-lib.sh + dest: test/test-lib.sh + - src: ../../common/test-lib-openshift.sh + dest: test/test-lib-openshift.sh + - src: ../../common/test-lib-remote-openshift.sh + dest: test/test-lib-remote-openshift.sh + - src: ../../common/test-openshift.yaml + dest: test/test-openshift.yaml diff --git a/specs/multispec.yml b/specs/multispec.yml new file mode 100644 index 00000000..afdb44b1 --- /dev/null +++ b/specs/multispec.yml @@ -0,0 +1,122 @@ +version: 1 + +# Common fields derivable from `version:`'s components +_derived_version: &derived_version +# maps to RUBY_VERSION + stream: "{{ spec.version_major }}.{{ spec.version_minor }}" +# maps to RUBY_SCL_NAME_VERSION + tag: "{{ spec.version_major }}{{ spec.version_minor }}" + +_shared_distro_defaults: &shared_distro_defaults + base_rpm_install: |- + INSTALL_PKGS="{{ spec.all_pkgs }}" && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} + alternative_module_install: |- + INSTALL_PKGS="{{ spec.all_pkgs }}" && \ + dnf module enable -y ruby:{{ spec.stream }} && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} + alternative_rpm_install: |- + INSTALL_PKGS="ruby{{ spec.stream }} ruby{{ spec.stream }}-devel {{ spec.additional_packages }}" && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} + additional_packages: "redhat-rpm-config libffi-devel" + all_pkgs: "{{ spec.ruby_pkgs }} {{ spec.additional_packages }}" + # Field 'prod' is for disambiguation for images in sclorg/ image repos. + # other distros don't need it. + image_name_sclorg: "{% if config.os.id == 'centos-stream' %}-{{ spec.prod }}{% endif %}" + image_name: "{{ spec.org }}/ruby-{{ spec.tag }}{{ spec.image_name_sclorg }}" + openshift_tags: "builder,ruby,ruby{{ spec.tag }},ruby-{{ spec.tag }}" + +specs: + distroinfo: + fedora40: + distros: + - fedora-40-x86_64 + s2i_base: "quay.io/fedora/s2i-base:{{ config.os.version }}" + ruby_pkgs: "ruby ruby-devel rubygem-bundler ruby-bundled-gems rubygem-rake rubygems-devel" + org: "fedora" + base_ruby_rpm: "3.3" + <<: *shared_distro_defaults + fedora44: + distros: + - fedora-44-x86_64 + s2i_base: "quay.io/fedora/s2i-base:{{ config.os.version }}" + ruby_pkgs: "ruby ruby-devel rubygem-bundler ruby-bundled-gems rubygem-rake rubygems-devel" + org: "fedora" + base_ruby_rpm: "4.0" + <<: *shared_distro_defaults + rhel8: + distros: + - rhel-8-x86_64 + s2i_base: "ubi{{ config.os.version }}/s2i-base" + has_modules: true + # Base ruby is 2.5, but modular-only, there isn't a base non-modular version. + base_ruby_rpm: "" + org: "ubi8" + <<: *shared_distro_defaults + rhel9: + distros: + - rhel-9-x86_64 + s2i_base: "ubi{{ config.os.version }}/s2i-base" + has_modules: true + base_ruby_rpm: "3.0" + org: "ubi9" + <<: *shared_distro_defaults + rhel10: + distros: + - rhel-10-x86_64 + s2i_base: "ubi{{ config.os.version }}/s2i-base" + has_modules: false + base_ruby_rpm: "3.3" + org: "ubi10" + <<: *shared_distro_defaults + centos9: + distros: + - centos-stream-9-x86_64 + s2i_base: "quay.io/sclorg/s2i-base-c{{ config.os.version}}s:c{{ config.os.version}}s" + org: sclorg + prod: "c{{ config.os.version }}s" + base_ruby_rpm: "3.0" + has_modules: true + <<: *shared_distro_defaults + centos10: + distros: + - centos-stream-10-x86_64 + s2i_base: "quay.io/sclorg/s2i-base-c{{ config.os.version}}s:c{{ config.os.version}}s" + org: sclorg + prod: "c{{ config.os.version }}s" + base_ruby_rpm: "3.3" + has_modules: false + <<: *shared_distro_defaults + + version: + "2.5": + version_major: "2" + version_minor: "5" + ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler" + <<: *derived_version + "3.0": + version_major: "3" + version_minor: "0" + ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler" + <<: *derived_version + "3.3": + version_major: "3" + version_minor: "3" + ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems" + <<: *derived_version + "4.0": + version_major: "4" + version_minor: "0" + ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems" + <<: *derived_version + +matrix: + include: + - version: "2.5" + distros: [ rhel-8-x86_64 ] + - version: "3.0" + distros: [ rhel-9-x86_64 ] + - version: "3.3" + distros: [ rhel-8-x86_64, rhel-9-x86_64, centos-stream-10-x86_64, rhel-10-x86_64, fedora-40-x86_64 ] + - version: "4.0" + distros: [ rhel-9-x86_64, centos-stream-10-x86_64, rhel-10-x86_64, fedora-44-x86_64 ] diff --git a/src/Dockerfile.template b/src/Dockerfile.template new file mode 100644 index 00000000..bf13f793 --- /dev/null +++ b/src/Dockerfile.template @@ -0,0 +1,79 @@ +# This image provides a Ruby environment you can use to run your Ruby +# applications. +FROM {{ spec.s2i_base }} + +EXPOSE 8080 + +ENV RUBY_VERSION="{{ spec.stream }}" + +ENV RUBY_SCL="ruby-{{ spec.tag }}" \ + IMAGE_NAME="{{ spec.image_name }}" \ + SUMMARY="Platform for building and running Ruby {{ spec.stream }} applications." \ + DESCRIPTION="Ruby {{ spec.stream }} available as container is a base platform for \ +building and running various Ruby {{ spec.stream }} applications and frameworks. \ +Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ +It has many features to process text files and to do system management tasks (as in Perl). \ +It is simple, straight-forward, and extensible." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Ruby {{ spec.stream }}" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="{{ spec.openshift_tags }}" \ + com.redhat.component="ruby-{{ spec.tag }}-container" \ + name="{{ spec.image_name }}" \ +{% if config.os.id == "rhel" and config.os.version < 10 %} + version="1" \ +{% elif config.os.id == "centos-stream" %} + version="1" \ +{% elif config.os.id == "fedora" %} + version="0" \ +{% endif %} +{% if config.os.id == "rhel" %} + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ +{% endif %} + usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ +--context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ + maintainer="SoftwareCollections.org " + +{% if spec.base_ruby_rpm == spec.stream %} +RUN {{ spec.base_rpm_install }} && \ +{% elif spec.has_modules %} +RUN {{ spec.alternative_module_install }} && \ +{% else %} +RUN {{ spec.alternative_rpm_install }} && \ +{% endif %} +{% if (config.os.id == "rhel" or config.os.id == "centos-stream") and config.os.version >= 10 %} + dnf reinstall -y --setopt=tsflags=nodocs tzdata && \ +{% endif %} + dnf -y clean all --enablerepo='*' && \ +{% if spec.has_modules or spec.base_ruby_rpm == spec.stream %} + ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ +{% else %} + ruby{{ spec.stream }} -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ +{% endif %} + rpm -V ${INSTALL_PKGS} + +{% if not spec.has_modules and spec.base_ruby_rpm != spec.stream %} +# Symlink the binaries. Ruby now provides suffixed binaries in /usr/bin. +# Provide the non-suffixed version in the container. +RUN rpm -ql ruby{{ spec.stream }} ruby{{ spec.stream }}-devel | \ + grep '/usr/bin' | \ + xargs --max-args=1 basename -s ${RUBY_VERSION} | \ + xargs -I{} ln -s "/usr/bin/{}${RUBY_VERSION}" "/usr/bin/{}" +{% endif %} +# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH +COPY ./s2i/bin/ $STI_SCRIPTS_PATH + +# Copy extra files to the image. +COPY ./root/ / + +# Drop the root user and make the content of /opt/app-root owned by user 1001 +RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ + rpm-file-permissions + +USER 1001 + +# Set the default CMD to print the usage of the language image +CMD $STI_SCRIPTS_PATH/usage diff --git a/src/README.md b/src/README.md new file mode 100644 index 00000000..836c03af --- /dev/null +++ b/src/README.md @@ -0,0 +1,232 @@ +Ruby {{ spec.stream }} container image +======================== +This container image includes Ruby {{ spec.stream }} as a [S2I](https://github.com/openshift/source-to-image) base image for your Ruby {{ spec.stream }} applications. +Users can choose between RHEL, CentOS Stream and Fedora based builder images. +The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), +the CentOS Stream images are available on [Quay.io](https://quay.io/organization/sclorg), +and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). +The resulting image can be run using [podman](https://github.com/containers/libpod). + +Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments + +Description +----------- + +Ruby {{ spec.stream }} available as container is a base platform for +building and running various Ruby {{ spec.stream }} applications and frameworks. +Ruby is the interpreted scripting language for quick and easy object-oriented programming. +It has many features to process text files and to do system management tasks (as in Perl). +It is simple, straight-forward, and extensible. + +This container image includes an npm utility, so users can use it to install JavaScript +modules for their web applications. There is no guarantee for any specific npm or nodejs +version, that is included in the image; those versions can be changed anytime and +the nodejs itself is included just to make the npm work. + +See [the Red Hat Enterprise Linux Application Streams Life Cycle page](https://access.redhat.com/support/policy/updates/rhel-app-streams-life-cycle) for information about support for this particular stream. + +Usage in Openshift +------------------ +For this, we will assume that you are using the `ubi10/ruby-{{ spec.tag }}` image, available via `ruby:{{ spec.stream }}` imagestream tag in Openshift. +Building a simple [ruby-sample-app](https://github.com/sclorg/s2i-ruby-container/tree/master/{{ spec.stream }}/test/puma-test-app) application +in Openshift can be achieved with the following step: + + ``` + oc new-app ruby:{{ spec.stream }}~https://github.com/sclorg/rails-ex.git + ``` + +**Accessing the application:** +``` +$ oc get pods +$ oc exec -- curl 127.0.0.1:8080 +``` + +Source-to-Image framework and scripts +------------------------------------- +This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.4/builds/build-strategies.html#images-create-s2i_build-strategies) +(S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework +which makes it easy to write images that take application source code as +an input, use a builder image like this Ruby container image, and produce +a new image that runs the assembled application as an output. + +To support the Source-to-Image framework, important scripts are included in the builder image: + +* The `/usr/libexec/s2i/assemble` script inside the image is run to produce a new image with the application artifacts. The script takes sources of a given application and places them into appropriate directories inside the image. It utilizes some common patterns in Ruby application development (see the **Environment variables** section below). +* The `/usr/libexec/s2i/run` script is set as the default command in the resulting container image (the new image with the application artifacts). It configures web server and runs this server on port 8080. + +Building an application using a Dockerfile +------------------------------------------ +Compared to the Source-to-Image strategy, using a Dockerfile is a more +flexible way to build a Ruby container image with an application. +Use a Dockerfile when Source-to-Image is not sufficiently flexible for you or +when you build the image outside of the OpenShift environment. + +To use the Ruby image in a Dockerfile, follow these steps: + +#### 1. Pull a base builder image to build on + +``` +podman pull ubi10/ruby-{{ spec.tag }} +``` + +An RHEL10 image `ubi10/ruby-{{ spec.tag }}` is used in this example. + +#### 2. Pull and application code + + An example application available at https://github.com/sclorg/rails-ex.git is used here. Feel free to clone the repository for further experiments. + +``` +git clone https://github.com/sclorg/rails-ex.git app-src +``` + +#### 3. Prepare an application inside a container + +This step usually consists of at least these parts: + +* putting the application source into the container +* installing the dependencies +* setting the default command in the resulting image + +For all these three parts, users can use the Source-to-Image scripts inside the image ([3.1.](#31-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content)), or users can either setup all manually and use commands `ruby`, `bundle` and `rackup` explicitly in the Dockerfile ([3.2.](#32-to-use-your-own-setup-create-a-dockerfile-with-this-content)) + +##### 3.1 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: +``` +FROM ubi10/ruby-{{ spec.tag }} + +# Add application sources to a directory that the assemble scriptexpects them +# and set permissions so that the container runs without root access +USER 0 +ADD app-src /tmp/src +RUN chown -R 1001:0 /tmp/src +USER 1001 + +# Set up development mode +ENV RAILS_ENV=development + +# Install the dependencies +RUN /usr/libexec/s2i/assemble + +# Set the default command for the resulting image +CMD /usr/libexec/s2i/run +``` +The s2i scripts are used to set-up and run common Ruby applications. More information about the scripts can be found in [Source-to-Image](#source-to-image-framework-and-scripts) section. +##### 3.2 To use your own setup, create a Dockerfile with this content: +``` +FROM ubi10/ruby-{{ spec.tag }} + +USER 0 +ADD app-src ./ +RUN bundle config set --local path ./bundle && \ + bundle install + +CMD bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" +``` +#### 4. Build a new image from a Dockerfile prepared in the previous step + +``` +podman build -t ruby-app . +``` + +#### 5. Run the resulting image with final application +``` +podman run -d ruby-app +``` +Environment variables +--------------------- + +To set these environment variables, you can place them as a key value pair into a `.s2i/environment` +file inside your source code repository. + +* **RACK_ENV** + + This variable specifies the environment where the Ruby application will be deployed (unless overwritten) - `production`, `development`, `test`. + Each level has different behaviors in terms of logging verbosity, error pages, ruby gem installation, etc. + + **Note**: Application assets will be compiled only if the `RACK_ENV` is set to `production` + +* **DISABLE_ASSET_COMPILATION** + + This variable set to `true` indicates that the asset compilation process will be skipped. Since this only takes place + when the application is run in the `production` environment, it should only be used when assets are already compiled. + +* **PUMA_MIN_THREADS**, **PUMA_MAX_THREADS** + + These variables indicate the minimum and maximum threads that will be available in [Puma](https://github.com/puma/puma)'s thread pool. + +* **PUMA_WORKERS** + + This variable indicate the number of worker processes that will be launched. See documentation on Puma's [clustered mode](https://github.com/puma/puma#clustered-mode). + +* **RUBYGEM_MIRROR** + + Set this variable to use a custom RubyGems mirror URL to download required gem packages during build process. + +Hot deploy +---------- +In order to dynamically pick up changes made in your application source code, you need to make following steps: + +* **For Ruby on Rails applications** + + Run the built Rails image with the `RAILS_ENV=development` environment variable passed to the [podman](https://github.com/containers/libpod) `-e` run flag: + ``` + $ podman run -e RAILS_ENV=development -p 8080:8080 rails-app + ``` +* **For other types of Ruby applications (Sinatra, Padrino, etc.)** + + Your application needs to be built with one of gems that reloads the server every time changes in source code are done inside the running container. Those gems are: + * [Shotgun](https://github.com/rtomayko/shotgun) + * [Rerun](https://github.com/alexch/rerun) + * [Rack-livereload](https://github.com/johnbintz/rack-livereload) + + Please note that in order to be able to run your application in development mode, you need to modify the [S2I run script](https://github.com/openshift/source-to-image#anatomy-of-a-builder-image), so the web server is launched by the chosen gem, which checks for changes in the source code. + + After you built your application image with your version of [S2I run script](https://github.com/openshift/source-to-image#anatomy-of-a-builder-image), run the image with the RACK_ENV=development environment variable passed to the [podman](https://github.com/containers/libpod) -e run flag: + ``` + $ podman run -e RACK_ENV=development -p 8080:8080 sinatra-app + ``` + +To change your source code in running container, use Podman's [exec](https://github.com/containers/libpod) command: +``` +$ podman exec -it /bin/bash +``` + +After you [podman exec](https://github.com/containers/libpod) into the running container, your current +directory is set to `/opt/app-root/src`, where the source code is located. + +Performance tuning +------------------ +You can tune the number of threads per worker using the +`PUMA_MIN_THREADS` and `PUMA_MAX_THREADS` environment variables. +Additionally, the number of worker processes is determined by the number of CPU +cores that the container has available, as recommended by +[Puma](https://github.com/puma/puma)'s documentation. This is determined using +the cgroup [cpusets](https://www.kernel.org/doc/Documentation/cgroup-v1/cpusets.txt) +subsystem. You can specify the cores that the container is allowed to use by passing +the `--cpuset-cpus` parameter to the [podman](https://github.com/containers/libpod) run command: +``` +$ podman run -e PUMA_MAX_THREADS=32 --cpuset-cpus='0-2,3,5' -p 8080:8080 sinatra-app +``` +The number of workers is also limited by the memory limit that is enforced using +cgroups. The builder image assumes that you will need 50 MiB as a base and +another 15 MiB for every worker process plus 128 KiB for each thread. Note that +each worker has its own threads, so the total memory required for the whole +container is computed using the following formula: + +``` +50 + 15 * WORKERS + 0.125 * WORKERS * PUMA_MAX_THREADS +``` +You can specify a memory limit using the `--memory` flag: +``` +$ podman run -e PUMA_MAX_THREADS=32 --memory=300m -p 8080:8080 sinatra-app +``` +If memory is more limiting then the number of available cores, the number of +workers is scaled down accordingly to fit the above formula. The number of +workers can also be set explicitly by setting `PUMA_WORKERS`. + + +See also +-------- +Dockerfile and other sources are available on https://github.com/sclorg/s2i-ruby-container. +In that repository you also can find another versions of Ruby environment Dockerfiles. +The Dockerfile for RHEL9 is called `Dockerfile.rhel9`, for RHEL10 it's `Dockerfile.rhel10`, +for CentOS Stream 10 it's `Dockerfile.c10s` and the Fedora Dockerfile is called `Dockerfile.fedora`. diff --git a/src/root/opt/app-root/.gemrc b/src/root/opt/app-root/.gemrc new file mode 100644 index 00000000..2422bea3 --- /dev/null +++ b/src/root/opt/app-root/.gemrc @@ -0,0 +1,9 @@ +--- +install: --no-document +update: --no-document +:benchmark: false +:update_sources: true +:bulk_threshold: 1000 +:backtrace: true +:sources: +- https://rubygems.org/ diff --git a/src/root/opt/app-root/etc/puma.cfg b/src/root/opt/app-root/etc/puma.cfg new file mode 100644 index 00000000..a52d26dc --- /dev/null +++ b/src/root/opt/app-root/etc/puma.cfg @@ -0,0 +1,50 @@ +def get_max_memory() + return ENV['MEMORY_LIMIT_IN_BYTES'].to_i if ENV.has_key? 'MEMORY_LIMIT_IN_BYTES' + + # Assume unlimited memory. 0.size is the number of bytes a Ruby + # Fixnum class can hold. One bit is used for sign and one is used + # by Ruby to determine whether it's a number or pointer to an object. + # That's why we subtract two bits. This expresion should therefore be + # the largest signed Fixnum possible. + (2 ** (8*0.size - 2) - 1) +end + +def get_memory_per_worker() + bytes = ENV.fetch('MEMORY_BYTES_PER_WORKER', '0').to_i + if bytes == 0 + # Comment describing rationale for choosing default of 256MiB/worker is below. + bytes = 256 * (2**20) + end + bytes +end + +def get_min_threads() + ENV.fetch('PUMA_MIN_THREADS', '0').to_i +end + +def get_max_threads() + ENV.fetch('PUMA_MAX_THREADS', '16').to_i +end + +# Determine the maximum number of workers that are allowed by the available +# memory. Puma documentation recommends the maximum number of workers to be +# set to the number of cores. +# Unless we're specifically tuned otherwise, allow one worker process per 256MiB +# memory, to a maximum of 1 worker / core. Hopefully that'll be a reasonable +# starting point for average apps; if not, it's all tunable. The simple +# OpenShift ruby/rails sample app currently requires approx. 60MiB + +# 70MiB/worker before taking its first request, so hopefully a default of +# 256MiB/worker will give other simple apps reasonable default headroom. +def get_workers() + return ENV['PUMA_WORKERS'].to_i if ENV.has_key? 'PUMA_WORKERS' + + cores = ENV.fetch('NUMBER_OF_CORES', '1').to_i + max_workers = get_max_memory() / get_memory_per_worker() + + [cores, max_workers].min +end + +environment ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'production' +threads get_min_threads(), get_max_threads() +workers get_workers() +bind 'tcp://0.0.0.0:8080' diff --git a/src/s2i/bin/assemble b/src/s2i/bin/assemble new file mode 100644 index 00000000..ae145815 --- /dev/null +++ b/src/s2i/bin/assemble @@ -0,0 +1,84 @@ +#!/bin/bash + +function rake_assets_precompile() { + [[ "$DISABLE_ASSET_COMPILATION" == "true" ]] && return + [ ! -f Gemfile ] && return + [ ! -f Rakefile ] && return + ! grep " rake " Gemfile.lock >/dev/null && return + ! bundle exec 'rake -T' | grep "assets:precompile" >/dev/null && return + + echo "---> Starting asset compilation ..." + bundle exec "rake assets:precompile" +} + +set -e + +export RACK_ENV=${RACK_ENV:-"production"} + +if [ -n "$RUBYGEM_MIRROR" ]; then + bundle config mirror.https://rubygems.org $RUBYGEM_MIRROR +fi + +shopt -s dotglob +echo "---> Installing application source ..." +mv /tmp/src/* ./ + +# Change the npm registry mirror if provided +if [ -n "$NPM_MIRROR" ]; then + npm config set registry $NPM_MIRROR +fi + +echo "---> Building your Ruby application from source ..." +if [ -f Gemfile ]; then + ADDTL_BUNDLE_ARGS="--retry 2" + if [ -f Gemfile.lock ]; then +{% if spec.stream == "2.5" %} + ADDTL_BUNDLE_ARGS+=" --deployment" +{% else %} + bundle config set --local deployment "true" +{% endif %} + fi + + if [[ "$RAILS_ENV" == "development" || "$RACK_ENV" == "development" ]]; then + BUNDLE_WITHOUT=${BUNDLE_WITHOUT:-"test"} + elif [[ "$RAILS_ENV" == "test" || "$RACK_ENV" == "test" ]]; then + BUNDLE_WITHOUT=${BUNDLE_WITHOUT:-"development"} + else + BUNDLE_WITHOUT=${BUNDLE_WITHOUT:-"development:test"} + fi + + if [ -n "$BUNDLE_WITHOUT" ]; then +{% if spec.stream == "2.5" %} + ADDTL_BUNDLE_ARGS+=" --without $BUNDLE_WITHOUT" +{% else %} + bundle config set --local without "$BUNDLE_WITHOUT" +{% endif %} + fi + + echo "---> Running 'bundle install ${ADDTL_BUNDLE_ARGS}' ..." +{% if spec.stream == "2.5" %} + bundle install --path ./bundle ${ADDTL_BUNDLE_ARGS} +{% else %} + bundle config set --local path "./bundle" + bundle install ${ADDTL_BUNDLE_ARGS} +{% endif %} + + echo "---> Cleaning up unused ruby gems ..." +{% if spec.stream == "2.5" %} + bundle clean -V +{% else %} + bundle clean --verbose +{% endif %} +fi + +if ! bundle exec rackup -h &>/dev/null; then + echo "WARNING: Rubygem Rack is not installed in the present image." + echo " Add rack to your Gemfile in order to start the web server." +fi + +if [[ "$RAILS_ENV" == "production" || "$RACK_ENV" == "production" ]]; then + rake_assets_precompile +fi + +# Fix source directory permissions +fix-permissions ./ diff --git a/src/s2i/bin/run b/src/s2i/bin/run new file mode 100755 index 00000000..1614ec3b --- /dev/null +++ b/src/s2i/bin/run @@ -0,0 +1,39 @@ +#!/bin/bash + +function is_puma_installed() { + [ ! -f Gemfile.lock ] && return 1 + grep ' puma ' Gemfile.lock >/dev/null +} + +set -e + +function check_number() { + if [[ ! "$2" =~ ^[0-9]+$ ]]; then + echo "$1 needs to be a non-negative number" + exit 1 + fi +} +check_number PUMA_WORKERS "${PUMA_WORKERS:-0}" +check_number PUMA_MIN_THREADS "${PUMA_MIN_THREADS:-0}" +check_number PUMA_MAX_THREADS "${PUMA_MAX_THREADS:-0}" + +export RACK_ENV=${RACK_ENV:-"production"} + +if is_puma_installed; then + export_vars=$(cgroup-limits) ; export $export_vars + + exec bundle exec "puma --config ../etc/puma.cfg" +else + echo "You might consider adding 'puma' into your Gemfile." + + if bundle exec rackup -h &>/dev/null; then + if [ -f Gemfile ]; then + exec bundle exec "rackup -E ${RAILS_ENV:-$RACK_ENV} -P /tmp/rack.pid --host 0.0.0.0 --port 8080" + else + exec rackup -E "${RAILS_ENV:-$RACK_ENV}" -P /tmp/rack.pid --host 0.0.0.0 --port 8080 + fi + else + echo "ERROR: Rubygem Rack is not installed in the present image." + echo " Add rack to your Gemfile in order to start the web server." + fi +fi diff --git a/src/s2i/bin/usage b/src/s2i/bin/usage new file mode 100755 index 00000000..76b9beb1 --- /dev/null +++ b/src/s2i/bin/usage @@ -0,0 +1,18 @@ +#!/bin/sh + +DISTRO="`grep ^ID= /etc/*-release | cut -d'"' -f2`" + +cat < -- curl 127.0.0.1:8080 + +Alternatively, to run the image directly using podman or docker, or how to use it as a parent image in a Dockerfile, see documentation at + +https://github.com/sclorg/s2i-ruby-container/blob/master/${RUBY_VERSION}/README.md +EOF From 6bd6b7402ef38369a88e658d7ee290f6ef67b1b1 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 31 Aug 2026 12:27:16 +0200 Subject: [PATCH 02/13] distgen: Move the per-version Gemfile for distgen. Each Ruby version may have special consideration to the required gem set. Specific distro choice usually does not enter the consideration to the Gemfile contents, the Ruby version is usually the deciding factor. Assisted-by: Claude Opus 4.8 (1M context) --- {2.5/test/puma-test-app => src/test/puma-test-app/2.5}/Gemfile | 0 .../puma-test-app => src/test/puma-test-app/2.5}/Gemfile.lock | 0 {3.0/test/puma-test-app => src/test/puma-test-app/3.0}/Gemfile | 0 .../puma-test-app => src/test/puma-test-app/3.0}/Gemfile.lock | 0 {3.3/test/puma-test-app => src/test/puma-test-app/3.3}/Gemfile | 0 .../puma-test-app => src/test/puma-test-app/3.3}/Gemfile.lock | 0 {4.0/test/puma-test-app => src/test/puma-test-app/4.0}/Gemfile | 0 .../puma-test-app => src/test/puma-test-app/4.0}/Gemfile.lock | 0 src/test/puma-test-app/Gemfile | 1 + src/test/puma-test-app/Gemfile.lock | 1 + {2.5/test/rack-test-app => src/test/rack-test-app/2.5}/Gemfile | 0 .../rack-test-app => src/test/rack-test-app/2.5}/Gemfile.lock | 0 {3.0/test/rack-test-app => src/test/rack-test-app/3.0}/Gemfile | 0 .../rack-test-app => src/test/rack-test-app/3.0}/Gemfile.lock | 0 {3.3/test/rack-test-app => src/test/rack-test-app/3.3}/Gemfile | 0 .../rack-test-app => src/test/rack-test-app/3.3}/Gemfile.lock | 0 {4.0/test/rack-test-app => src/test/rack-test-app/4.0}/Gemfile | 0 .../rack-test-app => src/test/rack-test-app/4.0}/Gemfile.lock | 0 src/test/rack-test-app/Gemfile | 1 + src/test/rack-test-app/Gemfile.lock | 1 + 20 files changed, 4 insertions(+) rename {2.5/test/puma-test-app => src/test/puma-test-app/2.5}/Gemfile (100%) rename {2.5/test/puma-test-app => src/test/puma-test-app/2.5}/Gemfile.lock (100%) rename {3.0/test/puma-test-app => src/test/puma-test-app/3.0}/Gemfile (100%) rename {3.0/test/puma-test-app => src/test/puma-test-app/3.0}/Gemfile.lock (100%) rename {3.3/test/puma-test-app => src/test/puma-test-app/3.3}/Gemfile (100%) rename {3.3/test/puma-test-app => src/test/puma-test-app/3.3}/Gemfile.lock (100%) rename {4.0/test/puma-test-app => src/test/puma-test-app/4.0}/Gemfile (100%) rename {4.0/test/puma-test-app => src/test/puma-test-app/4.0}/Gemfile.lock (100%) create mode 100644 src/test/puma-test-app/Gemfile create mode 100644 src/test/puma-test-app/Gemfile.lock rename {2.5/test/rack-test-app => src/test/rack-test-app/2.5}/Gemfile (100%) rename {2.5/test/rack-test-app => src/test/rack-test-app/2.5}/Gemfile.lock (100%) rename {3.0/test/rack-test-app => src/test/rack-test-app/3.0}/Gemfile (100%) rename {3.0/test/rack-test-app => src/test/rack-test-app/3.0}/Gemfile.lock (100%) rename {3.3/test/rack-test-app => src/test/rack-test-app/3.3}/Gemfile (100%) rename {3.3/test/rack-test-app => src/test/rack-test-app/3.3}/Gemfile.lock (100%) rename {4.0/test/rack-test-app => src/test/rack-test-app/4.0}/Gemfile (100%) rename {4.0/test/rack-test-app => src/test/rack-test-app/4.0}/Gemfile.lock (100%) create mode 100644 src/test/rack-test-app/Gemfile create mode 100644 src/test/rack-test-app/Gemfile.lock diff --git a/2.5/test/puma-test-app/Gemfile b/src/test/puma-test-app/2.5/Gemfile similarity index 100% rename from 2.5/test/puma-test-app/Gemfile rename to src/test/puma-test-app/2.5/Gemfile diff --git a/2.5/test/puma-test-app/Gemfile.lock b/src/test/puma-test-app/2.5/Gemfile.lock similarity index 100% rename from 2.5/test/puma-test-app/Gemfile.lock rename to src/test/puma-test-app/2.5/Gemfile.lock diff --git a/3.0/test/puma-test-app/Gemfile b/src/test/puma-test-app/3.0/Gemfile similarity index 100% rename from 3.0/test/puma-test-app/Gemfile rename to src/test/puma-test-app/3.0/Gemfile diff --git a/3.0/test/puma-test-app/Gemfile.lock b/src/test/puma-test-app/3.0/Gemfile.lock similarity index 100% rename from 3.0/test/puma-test-app/Gemfile.lock rename to src/test/puma-test-app/3.0/Gemfile.lock diff --git a/3.3/test/puma-test-app/Gemfile b/src/test/puma-test-app/3.3/Gemfile similarity index 100% rename from 3.3/test/puma-test-app/Gemfile rename to src/test/puma-test-app/3.3/Gemfile diff --git a/3.3/test/puma-test-app/Gemfile.lock b/src/test/puma-test-app/3.3/Gemfile.lock similarity index 100% rename from 3.3/test/puma-test-app/Gemfile.lock rename to src/test/puma-test-app/3.3/Gemfile.lock diff --git a/4.0/test/puma-test-app/Gemfile b/src/test/puma-test-app/4.0/Gemfile similarity index 100% rename from 4.0/test/puma-test-app/Gemfile rename to src/test/puma-test-app/4.0/Gemfile diff --git a/4.0/test/puma-test-app/Gemfile.lock b/src/test/puma-test-app/4.0/Gemfile.lock similarity index 100% rename from 4.0/test/puma-test-app/Gemfile.lock rename to src/test/puma-test-app/4.0/Gemfile.lock diff --git a/src/test/puma-test-app/Gemfile b/src/test/puma-test-app/Gemfile new file mode 100644 index 00000000..4b7d3202 --- /dev/null +++ b/src/test/puma-test-app/Gemfile @@ -0,0 +1 @@ +{% include "src/test/puma-test-app/" + spec.stream + "/Gemfile" %} diff --git a/src/test/puma-test-app/Gemfile.lock b/src/test/puma-test-app/Gemfile.lock new file mode 100644 index 00000000..6b0cf64d --- /dev/null +++ b/src/test/puma-test-app/Gemfile.lock @@ -0,0 +1 @@ +{% include "src/test/puma-test-app/" + spec.stream + "/Gemfile.lock" %} diff --git a/2.5/test/rack-test-app/Gemfile b/src/test/rack-test-app/2.5/Gemfile similarity index 100% rename from 2.5/test/rack-test-app/Gemfile rename to src/test/rack-test-app/2.5/Gemfile diff --git a/2.5/test/rack-test-app/Gemfile.lock b/src/test/rack-test-app/2.5/Gemfile.lock similarity index 100% rename from 2.5/test/rack-test-app/Gemfile.lock rename to src/test/rack-test-app/2.5/Gemfile.lock diff --git a/3.0/test/rack-test-app/Gemfile b/src/test/rack-test-app/3.0/Gemfile similarity index 100% rename from 3.0/test/rack-test-app/Gemfile rename to src/test/rack-test-app/3.0/Gemfile diff --git a/3.0/test/rack-test-app/Gemfile.lock b/src/test/rack-test-app/3.0/Gemfile.lock similarity index 100% rename from 3.0/test/rack-test-app/Gemfile.lock rename to src/test/rack-test-app/3.0/Gemfile.lock diff --git a/3.3/test/rack-test-app/Gemfile b/src/test/rack-test-app/3.3/Gemfile similarity index 100% rename from 3.3/test/rack-test-app/Gemfile rename to src/test/rack-test-app/3.3/Gemfile diff --git a/3.3/test/rack-test-app/Gemfile.lock b/src/test/rack-test-app/3.3/Gemfile.lock similarity index 100% rename from 3.3/test/rack-test-app/Gemfile.lock rename to src/test/rack-test-app/3.3/Gemfile.lock diff --git a/4.0/test/rack-test-app/Gemfile b/src/test/rack-test-app/4.0/Gemfile similarity index 100% rename from 4.0/test/rack-test-app/Gemfile rename to src/test/rack-test-app/4.0/Gemfile diff --git a/4.0/test/rack-test-app/Gemfile.lock b/src/test/rack-test-app/4.0/Gemfile.lock similarity index 100% rename from 4.0/test/rack-test-app/Gemfile.lock rename to src/test/rack-test-app/4.0/Gemfile.lock diff --git a/src/test/rack-test-app/Gemfile b/src/test/rack-test-app/Gemfile new file mode 100644 index 00000000..78a80f61 --- /dev/null +++ b/src/test/rack-test-app/Gemfile @@ -0,0 +1 @@ +{% include "src/test/rack-test-app/" + spec.stream + "/Gemfile" %} diff --git a/src/test/rack-test-app/Gemfile.lock b/src/test/rack-test-app/Gemfile.lock new file mode 100644 index 00000000..7cc944d6 --- /dev/null +++ b/src/test/rack-test-app/Gemfile.lock @@ -0,0 +1 @@ +{% include "src/test/rack-test-app/" + spec.stream + "/Gemfile.lock" %} From ca8989be25a32ed164416e2774885a694be29a98 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 31 Aug 2026 12:51:15 +0200 Subject: [PATCH 03/13] distgen: Move test apps to top-level test/ dir. The required files (Gemfile{,.lock}) are now templated via distgen. We can move the files to the main test/ dir. --- test/puma-test-app/app.rb | 5 +++ test/puma-test-app/config.ru | 2 + test/rack-test-app/app.rb | 5 +++ test/rack-test-app/config.ru | 2 + test/test-fips/Gemfile | 13 +++++++ test/test-fips/app.rb | 72 ++++++++++++++++++++++++++++++++++++ test/test-fips/config.ru | 2 + 7 files changed, 101 insertions(+) create mode 100755 test/puma-test-app/app.rb create mode 100755 test/puma-test-app/config.ru create mode 100755 test/rack-test-app/app.rb create mode 100755 test/rack-test-app/config.ru create mode 100644 test/test-fips/Gemfile create mode 100644 test/test-fips/app.rb create mode 100644 test/test-fips/config.ru diff --git a/test/puma-test-app/app.rb b/test/puma-test-app/app.rb new file mode 100755 index 00000000..cd7e87d7 --- /dev/null +++ b/test/puma-test-app/app.rb @@ -0,0 +1,5 @@ +require 'sinatra' + +get '/' do + 'Hello world!' +end diff --git a/test/puma-test-app/config.ru b/test/puma-test-app/config.ru new file mode 100755 index 00000000..76a6edff --- /dev/null +++ b/test/puma-test-app/config.ru @@ -0,0 +1,2 @@ +require './app' +run Sinatra::Application diff --git a/test/rack-test-app/app.rb b/test/rack-test-app/app.rb new file mode 100755 index 00000000..cd7e87d7 --- /dev/null +++ b/test/rack-test-app/app.rb @@ -0,0 +1,5 @@ +require 'sinatra' + +get '/' do + 'Hello world!' +end diff --git a/test/rack-test-app/config.ru b/test/rack-test-app/config.ru new file mode 100755 index 00000000..76a6edff --- /dev/null +++ b/test/rack-test-app/config.ru @@ -0,0 +1,2 @@ +require './app' +run Sinatra::Application diff --git a/test/test-fips/Gemfile b/test/test-fips/Gemfile new file mode 100644 index 00000000..21fff265 --- /dev/null +++ b/test/test-fips/Gemfile @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gem 'sinatra' + +gem 'rackup' + +# Use webrick for simple HTTP transport. +# this is not a production grade server, but gets the job done for the +# purpose of just sending something over for a request. +# Additionally there is an option to add SSL later here. +gem 'webrick' diff --git a/test/test-fips/app.rb b/test/test-fips/app.rb new file mode 100644 index 00000000..8c5a9eb0 --- /dev/null +++ b/test/test-fips/app.rb @@ -0,0 +1,72 @@ +require 'sinatra' +require 'openssl' + +set :server, 'webrick' +set :bind, '0.0.0.0' +set :port, 8080 + +MESSAGE = "My secret text\n".freeze + +get '/symmetric/aes-256-cbc' do + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + # This should pass with and without FIPS. + cipher = OpenSSL::Cipher.new('aes-256-cfb') + cipher.encrypt + cipher.random_key + cipher.random_iv + enc = cipher.update(MESSAGE) + cipher.final + return 200, enc +rescue => e + return 409, "Unexpected failure with aes-256-cbc, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end + +get '/symmetric/des-ede-cbc' do + status = 200 + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + + cipher = OpenSSL::Cipher.new('des-ede-cbc') + cipher.encrypt + # This fails in FIPS only once we try to get a key for the 3DES. + cipher.random_key + cipher.random_iv + cipher.update(MESSAGE) + cipher.final +rescue OpenSSL::Cipher::CipherError => e + return status, "Failed with fips #{fips_state} #{e.inspect}\n" if OpenSSL.fips_mode + + return 500, "Failed with fips #{fips_state} #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +rescue => e + return 409, "Unexpected failure with des-ede-cbc, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end + +get '/hash/sha256' do + status = 200 + + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + message = "SHA256 succeeded, fips is #{fips_state}" + + OpenSSL::Digest.digest('SHA256', MESSAGE) + + return status, message +rescue => e + return 409, "Unexpected failure with SHA256, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end + +get '/hash/md5' do + status = 200 + + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + message = "MD5 succeeded, fips is #{fips_state}" + + OpenSSL::Digest.digest('MD5', MESSAGE) + + # FIPS is on, but this passed, that shouldn't be the case. + status = 500 if OpenSSL.fips_mode + + return status, message +rescue OpenSSL::Digest::DigestError => e + return status, "Failed with fips #{fips_state} #{e.inspect}\n" if OpenSSL.fips_mode + + return 500, "Failed with fips #{fips_state} #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +rescue => e + return 409, "Unexpected failure with MD5, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end diff --git a/test/test-fips/config.ru b/test/test-fips/config.ru new file mode 100644 index 00000000..76a6edff --- /dev/null +++ b/test/test-fips/config.ru @@ -0,0 +1,2 @@ +require './app' +run Sinatra::Application From 15edefc825a6a32e59d7f35838e1c48bacd8fbdc Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 31 Aug 2026 12:54:27 +0200 Subject: [PATCH 04/13] distgen: Re-add generated test-app Gemfiles. --- 2.5/test/puma-test-app/Gemfile | 4 ++++ 2.5/test/puma-test-app/Gemfile.lock | 24 ++++++++++++++++++++++ 2.5/test/rack-test-app/Gemfile | 3 +++ 2.5/test/rack-test-app/Gemfile.lock | 22 ++++++++++++++++++++ 3.0/test/puma-test-app/Gemfile | 4 ++++ 3.0/test/puma-test-app/Gemfile.lock | 25 +++++++++++++++++++++++ 3.0/test/rack-test-app/Gemfile | 4 ++++ 3.0/test/rack-test-app/Gemfile.lock | 23 +++++++++++++++++++++ 3.3/test/puma-test-app/Gemfile | 4 ++++ 3.3/test/puma-test-app/Gemfile.lock | 25 +++++++++++++++++++++++ 3.3/test/rack-test-app/Gemfile | 4 ++++ 3.3/test/rack-test-app/Gemfile.lock | 23 +++++++++++++++++++++ 4.0/test/puma-test-app/Gemfile | 7 +++++++ 4.0/test/puma-test-app/Gemfile.lock | 31 +++++++++++++++++++++++++++++ 4.0/test/rack-test-app/Gemfile | 7 +++++++ 4.0/test/rack-test-app/Gemfile.lock | 29 +++++++++++++++++++++++++++ 16 files changed, 239 insertions(+) create mode 100644 2.5/test/puma-test-app/Gemfile create mode 100644 2.5/test/puma-test-app/Gemfile.lock create mode 100644 2.5/test/rack-test-app/Gemfile create mode 100644 2.5/test/rack-test-app/Gemfile.lock create mode 100644 3.0/test/puma-test-app/Gemfile create mode 100644 3.0/test/puma-test-app/Gemfile.lock create mode 100644 3.0/test/rack-test-app/Gemfile create mode 100644 3.0/test/rack-test-app/Gemfile.lock create mode 100644 3.3/test/puma-test-app/Gemfile create mode 100644 3.3/test/puma-test-app/Gemfile.lock create mode 100644 3.3/test/rack-test-app/Gemfile create mode 100644 3.3/test/rack-test-app/Gemfile.lock create mode 100644 4.0/test/puma-test-app/Gemfile create mode 100644 4.0/test/puma-test-app/Gemfile.lock create mode 100644 4.0/test/rack-test-app/Gemfile create mode 100644 4.0/test/rack-test-app/Gemfile.lock diff --git a/2.5/test/puma-test-app/Gemfile b/2.5/test/puma-test-app/Gemfile new file mode 100644 index 00000000..a98e5e1c --- /dev/null +++ b/2.5/test/puma-test-app/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'puma' diff --git a/2.5/test/puma-test-app/Gemfile.lock b/2.5/test/puma-test-app/Gemfile.lock new file mode 100644 index 00000000..aa4c5117 --- /dev/null +++ b/2.5/test/puma-test-app/Gemfile.lock @@ -0,0 +1,24 @@ +GEM + remote: https://rubygems.org/ + specs: + mustermann (1.0.3) + puma (3.12.1) + rack (2.0.6) + rack-protection (2.0.5) + rack + sinatra (2.0.5) + mustermann (~> 1.0) + rack (~> 2.0) + rack-protection (= 2.0.5) + tilt (~> 2.0) + tilt (2.0.9) + +PLATFORMS + ruby + +DEPENDENCIES + puma + sinatra + +BUNDLED WITH + 1.16.1 diff --git a/2.5/test/rack-test-app/Gemfile b/2.5/test/rack-test-app/Gemfile new file mode 100644 index 00000000..c10abd72 --- /dev/null +++ b/2.5/test/rack-test-app/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'sinatra' diff --git a/2.5/test/rack-test-app/Gemfile.lock b/2.5/test/rack-test-app/Gemfile.lock new file mode 100644 index 00000000..73502e0b --- /dev/null +++ b/2.5/test/rack-test-app/Gemfile.lock @@ -0,0 +1,22 @@ +GEM + remote: https://rubygems.org/ + specs: + mustermann (1.0.3) + rack (2.0.6) + rack-protection (2.0.5) + rack + sinatra (2.0.5) + mustermann (~> 1.0) + rack (~> 2.0) + rack-protection (= 2.0.5) + tilt (~> 2.0) + tilt (2.0.9) + +PLATFORMS + ruby + +DEPENDENCIES + sinatra + +BUNDLED WITH + 1.16.1 diff --git a/3.0/test/puma-test-app/Gemfile b/3.0/test/puma-test-app/Gemfile new file mode 100644 index 00000000..a98e5e1c --- /dev/null +++ b/3.0/test/puma-test-app/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'puma' diff --git a/3.0/test/puma-test-app/Gemfile.lock b/3.0/test/puma-test-app/Gemfile.lock new file mode 100644 index 00000000..052f5933 --- /dev/null +++ b/3.0/test/puma-test-app/Gemfile.lock @@ -0,0 +1,25 @@ +GEM + remote: https://rubygems.org/ + specs: + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + nio4r (2.5.7) + puma (5.2.2) + nio4r (~> 2.0) + rack (2.2.3) + rack-protection (2.1.0) + rack + ruby2_keywords (0.0.4) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) + tilt (2.0.10) + +PLATFORMS + ruby + +DEPENDENCIES + puma + sinatra diff --git a/3.0/test/rack-test-app/Gemfile b/3.0/test/rack-test-app/Gemfile new file mode 100644 index 00000000..d89e792e --- /dev/null +++ b/3.0/test/rack-test-app/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'webrick' diff --git a/3.0/test/rack-test-app/Gemfile.lock b/3.0/test/rack-test-app/Gemfile.lock new file mode 100644 index 00000000..883bfb2b --- /dev/null +++ b/3.0/test/rack-test-app/Gemfile.lock @@ -0,0 +1,23 @@ +GEM + remote: https://rubygems.org/ + specs: + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + rack (2.2.3) + rack-protection (2.1.0) + rack + ruby2_keywords (0.0.4) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) + tilt (2.0.10) + webrick (1.7.0) + +PLATFORMS + ruby + +DEPENDENCIES + sinatra + webrick diff --git a/3.3/test/puma-test-app/Gemfile b/3.3/test/puma-test-app/Gemfile new file mode 100644 index 00000000..a98e5e1c --- /dev/null +++ b/3.3/test/puma-test-app/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'puma' diff --git a/3.3/test/puma-test-app/Gemfile.lock b/3.3/test/puma-test-app/Gemfile.lock new file mode 100644 index 00000000..1d327833 --- /dev/null +++ b/3.3/test/puma-test-app/Gemfile.lock @@ -0,0 +1,25 @@ +GEM + remote: https://rubygems.org/ + specs: + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + nio4r (2.7.3) + puma (5.2.2) + nio4r (~> 2.0) + rack (2.2.3) + rack-protection (2.1.0) + rack + ruby2_keywords (0.0.4) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) + tilt (2.0.10) + +PLATFORMS + ruby + +DEPENDENCIES + puma + sinatra diff --git a/3.3/test/rack-test-app/Gemfile b/3.3/test/rack-test-app/Gemfile new file mode 100644 index 00000000..d89e792e --- /dev/null +++ b/3.3/test/rack-test-app/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'webrick' diff --git a/3.3/test/rack-test-app/Gemfile.lock b/3.3/test/rack-test-app/Gemfile.lock new file mode 100644 index 00000000..883bfb2b --- /dev/null +++ b/3.3/test/rack-test-app/Gemfile.lock @@ -0,0 +1,23 @@ +GEM + remote: https://rubygems.org/ + specs: + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + rack (2.2.3) + rack-protection (2.1.0) + rack + ruby2_keywords (0.0.4) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) + tilt (2.0.10) + webrick (1.7.0) + +PLATFORMS + ruby + +DEPENDENCIES + sinatra + webrick diff --git a/4.0/test/puma-test-app/Gemfile b/4.0/test/puma-test-app/Gemfile new file mode 100644 index 00000000..d4a7c681 --- /dev/null +++ b/4.0/test/puma-test-app/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'puma' +gem 'ostruct' +gem 'base64' +gem 'logger' diff --git a/4.0/test/puma-test-app/Gemfile.lock b/4.0/test/puma-test-app/Gemfile.lock new file mode 100644 index 00000000..ef41ea47 --- /dev/null +++ b/4.0/test/puma-test-app/Gemfile.lock @@ -0,0 +1,31 @@ +GEM + remote: https://rubygems.org/ + specs: + base64 (0.3.0) + logger (1.7.0) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + nio4r (2.7.3) + ostruct (0.6.3) + puma (5.2.2) + nio4r (~> 2.0) + rack (2.2.3) + rack-protection (2.1.0) + rack + ruby2_keywords (0.0.4) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) + tilt (2.0.10) + +PLATFORMS + ruby + +DEPENDENCIES + base64 + logger + ostruct + puma + sinatra diff --git a/4.0/test/rack-test-app/Gemfile b/4.0/test/rack-test-app/Gemfile new file mode 100644 index 00000000..b9e092c4 --- /dev/null +++ b/4.0/test/rack-test-app/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'sinatra' +gem 'webrick' +gem 'ostruct' +gem 'base64' +gem 'logger' diff --git a/4.0/test/rack-test-app/Gemfile.lock b/4.0/test/rack-test-app/Gemfile.lock new file mode 100644 index 00000000..47d6d53e --- /dev/null +++ b/4.0/test/rack-test-app/Gemfile.lock @@ -0,0 +1,29 @@ +GEM + remote: https://rubygems.org/ + specs: + base64 (0.3.0) + logger (1.7.0) + mustermann (1.1.1) + ruby2_keywords (~> 0.0.1) + ostruct (0.6.3) + rack (2.2.3) + rack-protection (2.1.0) + rack + ruby2_keywords (0.0.4) + sinatra (2.1.0) + mustermann (~> 1.0) + rack (~> 2.2) + rack-protection (= 2.1.0) + tilt (~> 2.0) + tilt (2.0.10) + webrick (1.7.0) + +PLATFORMS + ruby + +DEPENDENCIES + base64 + logger + ostruct + sinatra + webrick From d0f28bb4ad4058e248532835089a3faccddf0710 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 31 Aug 2026 18:01:29 +0200 Subject: [PATCH 05/13] distgen: Generalize version-specific README.md to be usable across versions. Similarly to python, use equivalent of 'main_image', but name it such that it is clear its use is to be the reference image for README. --- specs/multispec.yml | 4 ++++ src/README.md | 21 ++++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/specs/multispec.yml b/specs/multispec.yml index afdb44b1..84210fab 100644 --- a/specs/multispec.yml +++ b/specs/multispec.yml @@ -93,21 +93,25 @@ specs: version_major: "2" version_minor: "5" ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler" + readme_ref_image: "registry.access.redhat.com/ubi8/ruby-25" <<: *derived_version "3.0": version_major: "3" version_minor: "0" ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler" + readme_ref_image: "registry.access.redhat.com/ubi9/ruby-30" <<: *derived_version "3.3": version_major: "3" version_minor: "3" ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems" + readme_ref_image: "registry.access.redhat.com/ubi10/ruby-33" <<: *derived_version "4.0": version_major: "4" version_minor: "0" ruby_pkgs: "ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems" + readme_ref_image: "registry.access.redhat.com/ubi10/ruby-40" <<: *derived_version matrix: diff --git a/src/README.md b/src/README.md index 836c03af..9bd8f13b 100644 --- a/src/README.md +++ b/src/README.md @@ -27,7 +27,7 @@ See [the Red Hat Enterprise Linux Application Streams Life Cycle page](https://a Usage in Openshift ------------------ -For this, we will assume that you are using the `ubi10/ruby-{{ spec.tag }}` image, available via `ruby:{{ spec.stream }}` imagestream tag in Openshift. +For this, we will assume that you are using the `{{ spec.readme_ref_image }}` image, available via `ruby:{{ spec.stream }}` imagestream tag in Openshift. Building a simple [ruby-sample-app](https://github.com/sclorg/s2i-ruby-container/tree/master/{{ spec.stream }}/test/puma-test-app) application in Openshift can be achieved with the following step: @@ -66,10 +66,10 @@ To use the Ruby image in a Dockerfile, follow these steps: #### 1. Pull a base builder image to build on ``` -podman pull ubi10/ruby-{{ spec.tag }} +podman pull {{ spec.readme_ref_image }} ``` -An RHEL10 image `ubi10/ruby-{{ spec.tag }}` is used in this example. +The `{{ spec.readme_ref_image }}` container image is used in this example. #### 2. Pull and application code @@ -91,7 +91,7 @@ For all these three parts, users can use the Source-to-Image scripts inside the ##### 3.1 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: ``` -FROM ubi10/ruby-{{ spec.tag }} +FROM {{ spec.readme_ref_image }} # Add application sources to a directory that the assemble scriptexpects them # and set permissions so that the container runs without root access @@ -112,12 +112,18 @@ CMD /usr/libexec/s2i/run The s2i scripts are used to set-up and run common Ruby applications. More information about the scripts can be found in [Source-to-Image](#source-to-image-framework-and-scripts) section. ##### 3.2 To use your own setup, create a Dockerfile with this content: ``` -FROM ubi10/ruby-{{ spec.tag }} +FROM {{ spec.readme_ref_image }} USER 0 ADD app-src ./ +{# bundler in Ruby >= 3.3 should use the 'config set'. #} +{# earlier rubies have either limited support or different CLI usage. #} +{% if spec.stream in ["2.5", "3.0"] %} +RUN bundle install --path ./bundle +{% else %} RUN bundle config set --local path ./bundle && \ bundle install +{% endif %} CMD bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" ``` @@ -228,5 +234,6 @@ See also -------- Dockerfile and other sources are available on https://github.com/sclorg/s2i-ruby-container. In that repository you also can find another versions of Ruby environment Dockerfiles. -The Dockerfile for RHEL9 is called `Dockerfile.rhel9`, for RHEL10 it's `Dockerfile.rhel10`, -for CentOS Stream 10 it's `Dockerfile.c10s` and the Fedora Dockerfile is called `Dockerfile.fedora`. +Dockerfile for RHEL8 is called `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, +for CentOS Stream 9 it's `Dockerfile.c9s`, for CentOS Stream 10 it's `Dockerfile.c10s`, +and the Fedora Dockerfile is called `Dockerfile.fedora`. From 8c4d66ba8b8328358396623bd91828fefd4c99f5 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 31 Aug 2026 18:19:45 +0200 Subject: [PATCH 06/13] Remove dead symlinks into the git submodules. Multiple files seem to have been removed from the common module that existing versions referred to via a symlink. Remove those dangling symlinks. --- 2.5/test/test-lib-openshift.sh | 1 - 2.5/test/test-lib-remote-openshift.sh | 1 - 2.5/test/test-openshift.yaml | 1 - 3.0/test/test-lib-openshift.sh | 1 - 3.0/test/test-lib-remote-openshift.sh | 1 - 3.0/test/test-openshift.yaml | 1 - 3.3/test/test-lib-openshift.sh | 1 - 3.3/test/test-lib-remote-openshift.sh | 1 - 3.3/test/test-openshift.yaml | 1 - manifest.yml | 6 ------ 10 files changed, 15 deletions(-) delete mode 120000 2.5/test/test-lib-openshift.sh delete mode 120000 2.5/test/test-lib-remote-openshift.sh delete mode 120000 2.5/test/test-openshift.yaml delete mode 120000 3.0/test/test-lib-openshift.sh delete mode 120000 3.0/test/test-lib-remote-openshift.sh delete mode 120000 3.0/test/test-openshift.yaml delete mode 120000 3.3/test/test-lib-openshift.sh delete mode 120000 3.3/test/test-lib-remote-openshift.sh delete mode 120000 3.3/test/test-openshift.yaml diff --git a/2.5/test/test-lib-openshift.sh b/2.5/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f2996..00000000 --- a/2.5/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/2.5/test/test-lib-remote-openshift.sh b/2.5/test/test-lib-remote-openshift.sh deleted file mode 120000 index 92ad2f4d..00000000 --- a/2.5/test/test-lib-remote-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-remote-openshift.sh \ No newline at end of file diff --git a/2.5/test/test-openshift.yaml b/2.5/test/test-openshift.yaml deleted file mode 120000 index 8613fbba..00000000 --- a/2.5/test/test-openshift.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/test-openshift.yaml \ No newline at end of file diff --git a/3.0/test/test-lib-openshift.sh b/3.0/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f2996..00000000 --- a/3.0/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/3.0/test/test-lib-remote-openshift.sh b/3.0/test/test-lib-remote-openshift.sh deleted file mode 120000 index 92ad2f4d..00000000 --- a/3.0/test/test-lib-remote-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-remote-openshift.sh \ No newline at end of file diff --git a/3.0/test/test-openshift.yaml b/3.0/test/test-openshift.yaml deleted file mode 120000 index 8613fbba..00000000 --- a/3.0/test/test-openshift.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/test-openshift.yaml \ No newline at end of file diff --git a/3.3/test/test-lib-openshift.sh b/3.3/test/test-lib-openshift.sh deleted file mode 120000 index 4f9f2996..00000000 --- a/3.3/test/test-lib-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-openshift.sh \ No newline at end of file diff --git a/3.3/test/test-lib-remote-openshift.sh b/3.3/test/test-lib-remote-openshift.sh deleted file mode 120000 index 92ad2f4d..00000000 --- a/3.3/test/test-lib-remote-openshift.sh +++ /dev/null @@ -1 +0,0 @@ -../../common/test-lib-remote-openshift.sh \ No newline at end of file diff --git a/3.3/test/test-openshift.yaml b/3.3/test/test-openshift.yaml deleted file mode 120000 index 8613fbba..00000000 --- a/3.3/test/test-openshift.yaml +++ /dev/null @@ -1 +0,0 @@ -../../common/test-openshift.yaml \ No newline at end of file diff --git a/manifest.yml b/manifest.yml index 5eca7cce..d1b0e42b 100644 --- a/manifest.yml +++ b/manifest.yml @@ -102,9 +102,3 @@ SYMLINK_RULES: dest: test/test_ocp_s2i_templates.py - src: ../../common/test-lib.sh dest: test/test-lib.sh - - src: ../../common/test-lib-openshift.sh - dest: test/test-lib-openshift.sh - - src: ../../common/test-lib-remote-openshift.sh - dest: test/test-lib-remote-openshift.sh - - src: ../../common/test-openshift.yaml - dest: test/test-openshift.yaml From 9b74d837dd0ed80c2c6eb101f7d9f6bd07ec9ff2 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 1 Sep 2026 10:22:26 +0200 Subject: [PATCH 07/13] distgen: Remove content_sets.yml from Ruby 2.5. Seems this file is here from RHEL 7 era, which is not a valid target of the repo for some time. We should be safe to just remove it, newer streams do not contain the file. --- 2.5/content_sets.yml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 2.5/content_sets.yml diff --git a/2.5/content_sets.yml b/2.5/content_sets.yml deleted file mode 100644 index 432c0914..00000000 --- a/2.5/content_sets.yml +++ /dev/null @@ -1,10 +0,0 @@ -# This is a file defining which content sets are needed to update content in -# this image. Data provided here helps determine which images are vulnerable to -# specific CVEs. Generally you should only need to update this file when: -# 1. You start depending on new product -# 2. You are preparing new product release and your content sets will change ---- -x86_64: -- rhel-7-server-rpms -- rhel-7-server-optional-rpms -- rhel-server-rhscl-7-rpms From 66082775666d7ad09a97311a8fec8b41457c0ce1 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 1 Sep 2026 10:24:18 +0200 Subject: [PATCH 08/13] distgen: Ruby 3.0's s2i assemble does not need comments now. The comments explain why this was added, newer rubies do not contain the comments at all, we can just go forward without them. Newer bundler from newer rubies should not accept the deprecated setting form anyway. --- 3.0/s2i/bin/assemble | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/3.0/s2i/bin/assemble b/3.0/s2i/bin/assemble index 42c622e7..5c9d32d4 100755 --- a/3.0/s2i/bin/assemble +++ b/3.0/s2i/bin/assemble @@ -32,12 +32,6 @@ echo "---> Building your Ruby application from source ..." if [ -f Gemfile ]; then ADDTL_BUNDLE_ARGS="--retry 2" if [ -f Gemfile.lock ]; then - # This is new in version 3.0 - # [DEPRECATED] The `--deployment` flag is deprecated because it relies - # on being remembered across bundler invocations, - # which bundler will no longer do in future versions. - # Instead please use `bundle config set --local deployment 'true'`, - # and stop using this flag bundle config set --local deployment "true" fi @@ -48,22 +42,12 @@ if [ -f Gemfile ]; then else BUNDLE_WITHOUT=${BUNDLE_WITHOUT:-"development:test"} fi - + if [ -n "$BUNDLE_WITHOUT" ]; then - # [DEPRECATED] The `--without` flag is deprecated because - # it relies on being remembered across bundler invocations, - # which bundler will no longer do in future versions. - # Instead please use `bundle config set --local without ''test''`, - # and stop using this flag bundle config set --local without "$BUNDLE_WITHOUT" fi - + echo "---> Running 'bundle install ${ADDTL_BUNDLE_ARGS}' ..." - # [DEPRECATED] The `--path` flag is deprecated because - # it relies on being remembered across bundler invocations, - # which bundler will no longer do in future versions. - # Instead please use `bundle config set --local path './bundle'`, - # and stop using this flag bundle config set --local path "./bundle" bundle install ${ADDTL_BUNDLE_ARGS} From 3f617ed3a945ca2455b478635b30a5862dd0450c Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 1 Sep 2026 10:25:46 +0200 Subject: [PATCH 09/13] distgen: Generated 2.5 bin/assemble removes trailing whitespace. --- 2.5/s2i/bin/assemble | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2.5/s2i/bin/assemble b/2.5/s2i/bin/assemble index c2d292ce..50812ca0 100755 --- a/2.5/s2i/bin/assemble +++ b/2.5/s2i/bin/assemble @@ -42,11 +42,11 @@ if [ -f Gemfile ]; then else BUNDLE_WITHOUT=${BUNDLE_WITHOUT:-"development:test"} fi - + if [ -n "$BUNDLE_WITHOUT" ]; then ADDTL_BUNDLE_ARGS+=" --without $BUNDLE_WITHOUT" fi - + echo "---> Running 'bundle install ${ADDTL_BUNDLE_ARGS}' ..." bundle install --path ./bundle ${ADDTL_BUNDLE_ARGS} From e9949aee51040c7a914823780d50e46956062d21 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 15 Sep 2026 18:23:47 +0200 Subject: [PATCH 10/13] distgen: Split from-dockerfile test due to Ruby 2.5's bundler. Before distgen, due to Ruby 4.0's bundler >= 4.0, which no longer accepts the deprecated `--path` argument for `bundle install`, Ruby 2.5's from-dockerfile/Dockerfile test was forked to keep the deprecated form and `bundle config set` added for the Ruby >= 3.0. Special-case the file for Ruby 2.5, as it's the odd one out with the incompatibility. Assisted-by: Claude Sonnet 5 (1M context) --- 2.5/test/examples/from-dockerfile/Dockerfile | 3 +-- 3.0/test/examples | 1 - 3.0/test/examples/from-dockerfile/Dockerfile | 7 +++++++ .../examples/from-dockerfile/Dockerfile.s2i | 1 + 3.0/test/examples/from-dockerfile/README.md | 1 + .../examples/rails-postgresql-persistent.json | 1 + 3.0/test/examples/rails-postgresql.json | 1 + 3.0/test/examples/rails.json | 1 + 3.3/test/examples | 1 - 3.3/test/examples/from-dockerfile/Dockerfile | 7 +++++++ .../examples/from-dockerfile/Dockerfile.s2i | 1 + 3.3/test/examples/from-dockerfile/README.md | 1 + .../examples/rails-postgresql-persistent.json | 1 + 3.3/test/examples/rails-postgresql.json | 1 + 3.3/test/examples/rails.json | 1 + 4.0/test/examples | 1 - 4.0/test/examples/from-dockerfile/Dockerfile | 7 +++++++ .../examples/from-dockerfile/Dockerfile.s2i | 1 + 4.0/test/examples/from-dockerfile/README.md | 1 + .../examples/rails-postgresql-persistent.json | 1 + 4.0/test/examples/rails-postgresql.json | 1 + 4.0/test/examples/rails.json | 1 + manifest.yml | 18 ++++++++++++++++-- src/examples/from-dockerfile/Dockerfile | 11 +++++++++++ 24 files changed, 64 insertions(+), 7 deletions(-) delete mode 120000 3.0/test/examples create mode 100644 3.0/test/examples/from-dockerfile/Dockerfile create mode 120000 3.0/test/examples/from-dockerfile/Dockerfile.s2i create mode 120000 3.0/test/examples/from-dockerfile/README.md create mode 120000 3.0/test/examples/rails-postgresql-persistent.json create mode 120000 3.0/test/examples/rails-postgresql.json create mode 120000 3.0/test/examples/rails.json delete mode 120000 3.3/test/examples create mode 100644 3.3/test/examples/from-dockerfile/Dockerfile create mode 120000 3.3/test/examples/from-dockerfile/Dockerfile.s2i create mode 120000 3.3/test/examples/from-dockerfile/README.md create mode 120000 3.3/test/examples/rails-postgresql-persistent.json create mode 120000 3.3/test/examples/rails-postgresql.json create mode 120000 3.3/test/examples/rails.json delete mode 120000 4.0/test/examples create mode 100644 4.0/test/examples/from-dockerfile/Dockerfile create mode 120000 4.0/test/examples/from-dockerfile/Dockerfile.s2i create mode 120000 4.0/test/examples/from-dockerfile/README.md create mode 120000 4.0/test/examples/rails-postgresql-persistent.json create mode 120000 4.0/test/examples/rails-postgresql.json create mode 120000 4.0/test/examples/rails.json create mode 100644 src/examples/from-dockerfile/Dockerfile diff --git a/2.5/test/examples/from-dockerfile/Dockerfile b/2.5/test/examples/from-dockerfile/Dockerfile index 6cb7ac8b..dbe662aa 100644 --- a/2.5/test/examples/from-dockerfile/Dockerfile +++ b/2.5/test/examples/from-dockerfile/Dockerfile @@ -1,7 +1,6 @@ -FROM ubi8/ruby-25 +FROM registry.access.redhat.com/ubi8/ruby-25 ADD --chown=default:root app-src ./ - RUN bundle install --path bundle CMD exec bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" diff --git a/3.0/test/examples b/3.0/test/examples deleted file mode 120000 index d15735c1..00000000 --- a/3.0/test/examples +++ /dev/null @@ -1 +0,0 @@ -../../examples \ No newline at end of file diff --git a/3.0/test/examples/from-dockerfile/Dockerfile b/3.0/test/examples/from-dockerfile/Dockerfile new file mode 100644 index 00000000..368536ea --- /dev/null +++ b/3.0/test/examples/from-dockerfile/Dockerfile @@ -0,0 +1,7 @@ +FROM registry.access.redhat.com/ubi9/ruby-30 + +ADD --chown=default:root app-src ./ +RUN bundle config set --local path ./bundle && \ + bundle install + +CMD exec bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" diff --git a/3.0/test/examples/from-dockerfile/Dockerfile.s2i b/3.0/test/examples/from-dockerfile/Dockerfile.s2i new file mode 120000 index 00000000..dfdb4e5c --- /dev/null +++ b/3.0/test/examples/from-dockerfile/Dockerfile.s2i @@ -0,0 +1 @@ +../../../../examples/from-dockerfile/Dockerfile.s2i \ No newline at end of file diff --git a/3.0/test/examples/from-dockerfile/README.md b/3.0/test/examples/from-dockerfile/README.md new file mode 120000 index 00000000..d9718e97 --- /dev/null +++ b/3.0/test/examples/from-dockerfile/README.md @@ -0,0 +1 @@ +../../../../examples/from-dockerfile/README.md \ No newline at end of file diff --git a/3.0/test/examples/rails-postgresql-persistent.json b/3.0/test/examples/rails-postgresql-persistent.json new file mode 120000 index 00000000..bfc3fbd5 --- /dev/null +++ b/3.0/test/examples/rails-postgresql-persistent.json @@ -0,0 +1 @@ +../../../examples/rails-postgresql-persistent.json \ No newline at end of file diff --git a/3.0/test/examples/rails-postgresql.json b/3.0/test/examples/rails-postgresql.json new file mode 120000 index 00000000..2a487a87 --- /dev/null +++ b/3.0/test/examples/rails-postgresql.json @@ -0,0 +1 @@ +../../../examples/rails-postgresql.json \ No newline at end of file diff --git a/3.0/test/examples/rails.json b/3.0/test/examples/rails.json new file mode 120000 index 00000000..41953b6b --- /dev/null +++ b/3.0/test/examples/rails.json @@ -0,0 +1 @@ +../../../examples/rails.json \ No newline at end of file diff --git a/3.3/test/examples b/3.3/test/examples deleted file mode 120000 index d15735c1..00000000 --- a/3.3/test/examples +++ /dev/null @@ -1 +0,0 @@ -../../examples \ No newline at end of file diff --git a/3.3/test/examples/from-dockerfile/Dockerfile b/3.3/test/examples/from-dockerfile/Dockerfile new file mode 100644 index 00000000..76d87d48 --- /dev/null +++ b/3.3/test/examples/from-dockerfile/Dockerfile @@ -0,0 +1,7 @@ +FROM registry.access.redhat.com/ubi10/ruby-33 + +ADD --chown=default:root app-src ./ +RUN bundle config set --local path ./bundle && \ + bundle install + +CMD exec bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" diff --git a/3.3/test/examples/from-dockerfile/Dockerfile.s2i b/3.3/test/examples/from-dockerfile/Dockerfile.s2i new file mode 120000 index 00000000..dfdb4e5c --- /dev/null +++ b/3.3/test/examples/from-dockerfile/Dockerfile.s2i @@ -0,0 +1 @@ +../../../../examples/from-dockerfile/Dockerfile.s2i \ No newline at end of file diff --git a/3.3/test/examples/from-dockerfile/README.md b/3.3/test/examples/from-dockerfile/README.md new file mode 120000 index 00000000..d9718e97 --- /dev/null +++ b/3.3/test/examples/from-dockerfile/README.md @@ -0,0 +1 @@ +../../../../examples/from-dockerfile/README.md \ No newline at end of file diff --git a/3.3/test/examples/rails-postgresql-persistent.json b/3.3/test/examples/rails-postgresql-persistent.json new file mode 120000 index 00000000..bfc3fbd5 --- /dev/null +++ b/3.3/test/examples/rails-postgresql-persistent.json @@ -0,0 +1 @@ +../../../examples/rails-postgresql-persistent.json \ No newline at end of file diff --git a/3.3/test/examples/rails-postgresql.json b/3.3/test/examples/rails-postgresql.json new file mode 120000 index 00000000..2a487a87 --- /dev/null +++ b/3.3/test/examples/rails-postgresql.json @@ -0,0 +1 @@ +../../../examples/rails-postgresql.json \ No newline at end of file diff --git a/3.3/test/examples/rails.json b/3.3/test/examples/rails.json new file mode 120000 index 00000000..41953b6b --- /dev/null +++ b/3.3/test/examples/rails.json @@ -0,0 +1 @@ +../../../examples/rails.json \ No newline at end of file diff --git a/4.0/test/examples b/4.0/test/examples deleted file mode 120000 index d15735c1..00000000 --- a/4.0/test/examples +++ /dev/null @@ -1 +0,0 @@ -../../examples \ No newline at end of file diff --git a/4.0/test/examples/from-dockerfile/Dockerfile b/4.0/test/examples/from-dockerfile/Dockerfile new file mode 100644 index 00000000..c39f9eba --- /dev/null +++ b/4.0/test/examples/from-dockerfile/Dockerfile @@ -0,0 +1,7 @@ +FROM registry.access.redhat.com/ubi10/ruby-40 + +ADD --chown=default:root app-src ./ +RUN bundle config set --local path ./bundle && \ + bundle install + +CMD exec bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" diff --git a/4.0/test/examples/from-dockerfile/Dockerfile.s2i b/4.0/test/examples/from-dockerfile/Dockerfile.s2i new file mode 120000 index 00000000..dfdb4e5c --- /dev/null +++ b/4.0/test/examples/from-dockerfile/Dockerfile.s2i @@ -0,0 +1 @@ +../../../../examples/from-dockerfile/Dockerfile.s2i \ No newline at end of file diff --git a/4.0/test/examples/from-dockerfile/README.md b/4.0/test/examples/from-dockerfile/README.md new file mode 120000 index 00000000..d9718e97 --- /dev/null +++ b/4.0/test/examples/from-dockerfile/README.md @@ -0,0 +1 @@ +../../../../examples/from-dockerfile/README.md \ No newline at end of file diff --git a/4.0/test/examples/rails-postgresql-persistent.json b/4.0/test/examples/rails-postgresql-persistent.json new file mode 120000 index 00000000..bfc3fbd5 --- /dev/null +++ b/4.0/test/examples/rails-postgresql-persistent.json @@ -0,0 +1 @@ +../../../examples/rails-postgresql-persistent.json \ No newline at end of file diff --git a/4.0/test/examples/rails-postgresql.json b/4.0/test/examples/rails-postgresql.json new file mode 120000 index 00000000..2a487a87 --- /dev/null +++ b/4.0/test/examples/rails-postgresql.json @@ -0,0 +1 @@ +../../../examples/rails-postgresql.json \ No newline at end of file diff --git a/4.0/test/examples/rails.json b/4.0/test/examples/rails.json new file mode 120000 index 00000000..41953b6b --- /dev/null +++ b/4.0/test/examples/rails.json @@ -0,0 +1 @@ +../../../examples/rails.json \ No newline at end of file diff --git a/manifest.yml b/manifest.yml index d1b0e42b..06c6819d 100644 --- a/manifest.yml +++ b/manifest.yml @@ -31,6 +31,10 @@ DISTGEN_RULES: - src: src/test/rack-test-app/Gemfile.lock dest: test/rack-test-app/Gemfile.lock + # from-dockerfile/Dockerfile: bundler CLI syntax differs on Ruby 2.5. + - src: src/examples/from-dockerfile/Dockerfile + dest: test/examples/from-dockerfile/Dockerfile + COPY_RULES: - src: src/s2i/bin/run dest: s2i/bin/run @@ -68,9 +72,19 @@ SYMLINK_RULES: dest: test/conftest.py - src: ../../test/__init__.py dest: test/__init__.py - - src: ../../examples - dest: test/examples + # examples/: from-dockerfile/Dockerfile is version-templated above (bundler + # CLI differs on 2.5), the rest is shared as-is. + - src: ../../../../examples/from-dockerfile/Dockerfile.s2i + dest: test/examples/from-dockerfile/Dockerfile.s2i + - src: ../../../../examples/from-dockerfile/README.md + dest: test/examples/from-dockerfile/README.md + - src: ../../../examples/rails-postgresql-persistent.json + dest: test/examples/rails-postgresql-persistent.json + - src: ../../../examples/rails-postgresql.json + dest: test/examples/rails-postgresql.json + - src: ../../../examples/rails.json + dest: test/examples/rails.json - src: ../../imagestreams dest: test/imagestreams diff --git a/src/examples/from-dockerfile/Dockerfile b/src/examples/from-dockerfile/Dockerfile new file mode 100644 index 00000000..8cb6d9b7 --- /dev/null +++ b/src/examples/from-dockerfile/Dockerfile @@ -0,0 +1,11 @@ +FROM {{ spec.readme_ref_image }} + +ADD --chown=default:root app-src ./ +{% if spec.stream == "2.5" %} +RUN bundle install --path bundle +{% else %} +RUN bundle config set --local path ./bundle && \ + bundle install +{% endif %} + +CMD exec bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" From 71d99074d9670fb34dc08da11662df678a1dedde Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 15 Sep 2026 18:29:22 +0200 Subject: [PATCH 11/13] distgen: test-fips is generated without exception. test-fips was not made for and is not expected to be used with RHEL 8. The specific pytest gates that correctly. But to prevent additional fork of files/generation, just add it also to Ruby 2.5 even if that Ruby is only available on RHEL 8. --- 2.5/test/test-fips/Gemfile | 13 +++++++ 2.5/test/test-fips/app.rb | 72 ++++++++++++++++++++++++++++++++++++ 2.5/test/test-fips/config.ru | 2 + 3 files changed, 87 insertions(+) create mode 100644 2.5/test/test-fips/Gemfile create mode 100644 2.5/test/test-fips/app.rb create mode 100644 2.5/test/test-fips/config.ru diff --git a/2.5/test/test-fips/Gemfile b/2.5/test/test-fips/Gemfile new file mode 100644 index 00000000..21fff265 --- /dev/null +++ b/2.5/test/test-fips/Gemfile @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +gem 'sinatra' + +gem 'rackup' + +# Use webrick for simple HTTP transport. +# this is not a production grade server, but gets the job done for the +# purpose of just sending something over for a request. +# Additionally there is an option to add SSL later here. +gem 'webrick' diff --git a/2.5/test/test-fips/app.rb b/2.5/test/test-fips/app.rb new file mode 100644 index 00000000..8c5a9eb0 --- /dev/null +++ b/2.5/test/test-fips/app.rb @@ -0,0 +1,72 @@ +require 'sinatra' +require 'openssl' + +set :server, 'webrick' +set :bind, '0.0.0.0' +set :port, 8080 + +MESSAGE = "My secret text\n".freeze + +get '/symmetric/aes-256-cbc' do + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + # This should pass with and without FIPS. + cipher = OpenSSL::Cipher.new('aes-256-cfb') + cipher.encrypt + cipher.random_key + cipher.random_iv + enc = cipher.update(MESSAGE) + cipher.final + return 200, enc +rescue => e + return 409, "Unexpected failure with aes-256-cbc, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end + +get '/symmetric/des-ede-cbc' do + status = 200 + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + + cipher = OpenSSL::Cipher.new('des-ede-cbc') + cipher.encrypt + # This fails in FIPS only once we try to get a key for the 3DES. + cipher.random_key + cipher.random_iv + cipher.update(MESSAGE) + cipher.final +rescue OpenSSL::Cipher::CipherError => e + return status, "Failed with fips #{fips_state} #{e.inspect}\n" if OpenSSL.fips_mode + + return 500, "Failed with fips #{fips_state} #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +rescue => e + return 409, "Unexpected failure with des-ede-cbc, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end + +get '/hash/sha256' do + status = 200 + + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + message = "SHA256 succeeded, fips is #{fips_state}" + + OpenSSL::Digest.digest('SHA256', MESSAGE) + + return status, message +rescue => e + return 409, "Unexpected failure with SHA256, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end + +get '/hash/md5' do + status = 200 + + fips_state = OpenSSL.fips_mode ? 'enabled' : 'disabled' + message = "MD5 succeeded, fips is #{fips_state}" + + OpenSSL::Digest.digest('MD5', MESSAGE) + + # FIPS is on, but this passed, that shouldn't be the case. + status = 500 if OpenSSL.fips_mode + + return status, message +rescue OpenSSL::Digest::DigestError => e + return status, "Failed with fips #{fips_state} #{e.inspect}\n" if OpenSSL.fips_mode + + return 500, "Failed with fips #{fips_state} #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +rescue => e + return 409, "Unexpected failure with MD5, fips #{fips_state}, #{e.inspect}\nBacktrace:\n#{e.backtrace}\n" +end diff --git a/2.5/test/test-fips/config.ru b/2.5/test/test-fips/config.ru new file mode 100644 index 00000000..76a6edff --- /dev/null +++ b/2.5/test/test-fips/config.ru @@ -0,0 +1,2 @@ +require './app' +run Sinatra::Application From 098822b6a6114c51e63027141d47a235a5b28205 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Tue, 15 Sep 2026 18:31:45 +0200 Subject: [PATCH 12/13] distgen: Fully re-generate files. --- 2.5/Dockerfile.rhel8 | 42 ++++++++++----------------- 2.5/README.md | 24 +++++++++------- 3.0/Dockerfile.c9s | 64 ----------------------------------------- 3.0/Dockerfile.rhel8 | 64 ----------------------------------------- 3.0/Dockerfile.rhel9 | 40 +++++++++----------------- 3.0/README.md | 22 +++++++++------ 3.3/Dockerfile.c10s | 38 ++++++++----------------- 3.3/Dockerfile.c9s | 66 ------------------------------------------- 3.3/Dockerfile.fedora | 34 +++++++++++----------- 3.3/Dockerfile.rhel10 | 37 ++++++++---------------- 3.3/Dockerfile.rhel8 | 43 ++++++++++------------------ 3.3/Dockerfile.rhel9 | 39 +++++++++---------------- 3.3/README.md | 24 ++++++++-------- 4.0/Dockerfile.c10s | 36 ++++++++--------------- 4.0/Dockerfile.c9s | 66 ------------------------------------------- 4.0/Dockerfile.fedora | 34 +++++++++++----------- 4.0/Dockerfile.rhel10 | 35 ++++++++--------------- 4.0/Dockerfile.rhel9 | 39 +++++++++---------------- 4.0/README.md | 21 +++++++------- 19 files changed, 201 insertions(+), 567 deletions(-) delete mode 100644 3.0/Dockerfile.c9s delete mode 100644 3.0/Dockerfile.rhel8 delete mode 100644 3.3/Dockerfile.c9s delete mode 100644 4.0/Dockerfile.c9s diff --git a/2.5/Dockerfile.rhel8 b/2.5/Dockerfile.rhel8 index 6f91d036..2c0b2597 100644 --- a/2.5/Dockerfile.rhel8 +++ b/2.5/Dockerfile.rhel8 @@ -1,21 +1,16 @@ -FROM ubi8/s2i-base - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM ubi8/s2i-base EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=2 \ - RUBY_MINOR_VERSION=5 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" +ENV RUBY_VERSION="2.5" -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi8/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-25" \ + IMAGE_NAME="ubi8/ruby-25" \ + SUMMARY="Platform for building and running Ruby 2.5 applications." \ + DESCRIPTION="Ruby 2.5 available as container is a base platform for \ +building and running various Ruby 2.5 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,28 +18,21 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 2.5" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby25,ruby-25" \ + com.redhat.component="ruby-25-container" \ + name="ubi8/ruby-25" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN yum -y module enable ruby:$RUBY_VERSION && \ - INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - redhat-rpm-config \ - " && \ - yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - yum -y clean all --enablerepo='*' && \ +RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler redhat-rpm-config libffi-devel" && \ + dnf module enable -y ruby:2.5 && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + dnf -y clean all --enablerepo='*' && \ ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ rpm -V ${INSTALL_PKGS} diff --git a/2.5/README.md b/2.5/README.md index 3393b291..c489ed9a 100644 --- a/2.5/README.md +++ b/2.5/README.md @@ -1,8 +1,10 @@ Ruby 2.5 container image ======================== This container image includes Ruby 2.5 as a [S2I](https://github.com/openshift/source-to-image) base image for your Ruby 2.5 applications. -Only the RHEL8 based builder image is available. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/). +Users can choose between RHEL, CentOS Stream and Fedora based builder images. +The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), +the CentOS Stream images are available on [Quay.io](https://quay.io/organization/sclorg), +and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). The resulting image can be run using [podman](https://github.com/containers/libpod). Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments @@ -16,7 +18,7 @@ Ruby is the interpreted scripting language for quick and easy object-oriented pr It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, and extensible. -This container image includes a npm utility, so users can use it to install JavaScript +This container image includes an npm utility, so users can use it to install JavaScript modules for their web applications. There is no guarantee for any specific npm or nodejs version, that is included in the image; those versions can be changed anytime and the nodejs itself is included just to make the npm work. @@ -25,7 +27,7 @@ See [the Red Hat Enterprise Linux Application Streams Life Cycle page](https://a Usage in Openshift ------------------ -For this, we will assume that you are using the `ubi8/ruby-25 image`, available via `ruby:2.5` imagestream tag in Openshift. +For this, we will assume that you are using the `registry.access.redhat.com/ubi8/ruby-25` image, available via `ruby:2.5` imagestream tag in Openshift. Building a simple [ruby-sample-app](https://github.com/sclorg/s2i-ruby-container/tree/master/2.5/test/puma-test-app) application in Openshift can be achieved with the following step: @@ -41,7 +43,7 @@ $ oc exec -- curl 127.0.0.1:8080 Source-to-Image framework and scripts ------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) +This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.4/builds/build-strategies.html#images-create-s2i_build-strategies) (S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework which makes it easy to write images that take application source code as an input, use a builder image like this Ruby container image, and produce @@ -64,10 +66,10 @@ To use the Ruby image in a Dockerfile, follow these steps: #### 1. Pull a base builder image to build on ``` -podman pull ubi8/ruby-25 +podman pull registry.access.redhat.com/ubi8/ruby-25 ``` -An RHEL8 image `ubi8/ruby-25` is used in this example. +The `registry.access.redhat.com/ubi8/ruby-25` container image is used in this example. #### 2. Pull and application code @@ -89,7 +91,7 @@ For all these three parts, users can use the Source-to-Image scripts inside the ##### 3.1 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: ``` -FROM ubi8/ruby-25 +FROM registry.access.redhat.com/ubi8/ruby-25 # Add application sources to a directory that the assemble scriptexpects them # and set permissions so that the container runs without root access @@ -110,7 +112,7 @@ CMD /usr/libexec/s2i/run The s2i scripts are used to set-up and run common Ruby applications. More information about the scripts can be found in [Source-to-Image](#source-to-image-framework-and-scripts) section. ##### 3.2 To use your own setup, create a Dockerfile with this content: ``` -FROM ubi8/ruby-25 +FROM registry.access.redhat.com/ubi8/ruby-25 USER 0 ADD app-src ./ @@ -225,4 +227,6 @@ See also -------- Dockerfile and other sources are available on https://github.com/sclorg/s2i-ruby-container. In that repository you also can find another versions of Ruby environment Dockerfiles. -The Dockerfile for RHEL8 is called `Dockerfile.rhel8`. +Dockerfile for RHEL8 is called `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, +for CentOS Stream 9 it's `Dockerfile.c9s`, for CentOS Stream 10 it's `Dockerfile.c10s`, +and the Fedora Dockerfile is called `Dockerfile.fedora`. diff --git a/3.0/Dockerfile.c9s b/3.0/Dockerfile.c9s deleted file mode 100644 index 0497383b..00000000 --- a/3.0/Dockerfile.c9s +++ /dev/null @@ -1,64 +0,0 @@ -FROM quay.io/sclorg/s2i-base-c9s:c9s - -# This image provides a Ruby environment you can use to run your Ruby -# applications. - -EXPOSE 8080 - -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=0 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" - -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi8/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ -Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ -It has many features to process text files and to do system management tasks (as in Perl). \ -It is simple, straight-forward, and extensible." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ ---context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ - maintainer="SoftwareCollections.org " - -RUN INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - redhat-rpm-config \ - " && \ - yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - yum reinstall -y --setopt=tsflags=nodocs tzdata && \ - yum -y clean all --enablerepo='*' && \ - ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ - rpm -V ${INSTALL_PKGS} - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/3.0/Dockerfile.rhel8 b/3.0/Dockerfile.rhel8 deleted file mode 100644 index eb44169e..00000000 --- a/3.0/Dockerfile.rhel8 +++ /dev/null @@ -1,64 +0,0 @@ -FROM ubi8/s2i-base - -# This image provides a Ruby environment you can use to run your Ruby -# applications. - -EXPOSE 8080 - -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=0 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" - -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi8/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ -Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ -It has many features to process text files and to do system management tasks (as in Perl). \ -It is simple, straight-forward, and extensible." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ ---context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ - maintainer="SoftwareCollections.org " - -RUN yum -y module enable ruby:$RUBY_VERSION && \ - INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - redhat-rpm-config \ - " && \ - yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - yum -y clean all --enablerepo='*' && \ - ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ - rpm -V ${INSTALL_PKGS} - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/3.0/Dockerfile.rhel9 b/3.0/Dockerfile.rhel9 index a2d335b0..7ee0fc8f 100644 --- a/3.0/Dockerfile.rhel9 +++ b/3.0/Dockerfile.rhel9 @@ -1,21 +1,16 @@ -FROM ubi9/s2i-base - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM ubi9/s2i-base EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=0 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" +ENV RUBY_VERSION="3.0" -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi9/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-30" \ + IMAGE_NAME="ubi9/ruby-30" \ + SUMMARY="Platform for building and running Ruby 3.0 applications." \ + DESCRIPTION="Ruby 3.0 available as container is a base platform for \ +building and running various Ruby 3.0 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,27 +18,20 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 3.0" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby30,ruby-30" \ + com.redhat.component="ruby-30-container" \ + name="ubi9/ruby-30" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - redhat-rpm-config \ - " && \ - yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - yum -y clean all --enablerepo='*' && \ +RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler redhat-rpm-config libffi-devel" && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + dnf -y clean all --enablerepo='*' && \ ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ rpm -V ${INSTALL_PKGS} diff --git a/3.0/README.md b/3.0/README.md index 072fa31e..7726745e 100644 --- a/3.0/README.md +++ b/3.0/README.md @@ -1,8 +1,10 @@ Ruby 3.0 container image ======================== This container image includes Ruby 3.0 as a [S2I](https://github.com/openshift/source-to-image) base image for your Ruby 3.0 applications. -Only the RHEL9 based builder image is available. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/). +Users can choose between RHEL, CentOS Stream and Fedora based builder images. +The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), +the CentOS Stream images are available on [Quay.io](https://quay.io/organization/sclorg), +and the Fedora images are available in [Quay.io](https://quay.io/organization/fedora). The resulting image can be run using [podman](https://github.com/containers/libpod). Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments @@ -25,7 +27,7 @@ See [the Red Hat Enterprise Linux Application Streams Life Cycle page](https://a Usage in Openshift ------------------ -For this, we will assume that you are using the `ubi9/ruby-30 image`, available via `ruby:3.0` imagestream tag in Openshift. +For this, we will assume that you are using the `registry.access.redhat.com/ubi9/ruby-30` image, available via `ruby:3.0` imagestream tag in Openshift. Building a simple [ruby-sample-app](https://github.com/sclorg/s2i-ruby-container/tree/master/3.0/test/puma-test-app) application in Openshift can be achieved with the following step: @@ -41,7 +43,7 @@ $ oc exec -- curl 127.0.0.1:8080 Source-to-Image framework and scripts ------------------------------------- -This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) +This image supports the [Source-to-Image](https://docs.openshift.com/container-platform/4.4/builds/build-strategies.html#images-create-s2i_build-strategies) (S2I) strategy in OpenShift. The Source-to-Image is an OpenShift framework which makes it easy to write images that take application source code as an input, use a builder image like this Ruby container image, and produce @@ -64,10 +66,10 @@ To use the Ruby image in a Dockerfile, follow these steps: #### 1. Pull a base builder image to build on ``` -podman pull ubi9/ruby-30 +podman pull registry.access.redhat.com/ubi9/ruby-30 ``` -A RHEL9 image `ubi9/ruby-30` is used in this example. +The `registry.access.redhat.com/ubi9/ruby-30` container image is used in this example. #### 2. Pull and application code @@ -89,7 +91,7 @@ For all these three parts, users can use the Source-to-Image scripts inside the ##### 3.1 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: ``` -FROM ubi9/ruby-30 +FROM registry.access.redhat.com/ubi9/ruby-30 # Add application sources to a directory that the assemble scriptexpects them # and set permissions so that the container runs without root access @@ -110,7 +112,7 @@ CMD /usr/libexec/s2i/run The s2i scripts are used to set-up and run common Ruby applications. More information about the scripts can be found in [Source-to-Image](#source-to-image-framework-and-scripts) section. ##### 3.2 To use your own setup, create a Dockerfile with this content: ``` -FROM ubi9/ruby-30 +FROM registry.access.redhat.com/ubi9/ruby-30 USER 0 ADD app-src ./ @@ -225,4 +227,6 @@ See also -------- Dockerfile and other sources are available on https://github.com/sclorg/s2i-ruby-container. In that repository you also can find another versions of Ruby environment Dockerfiles. -The Dockerfile for RHEL9 is called `Dockerfile.rhel9`. \ No newline at end of file +Dockerfile for RHEL8 is called `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, +for CentOS Stream 9 it's `Dockerfile.c9s`, for CentOS Stream 10 it's `Dockerfile.c10s`, +and the Fedora Dockerfile is called `Dockerfile.fedora`. diff --git a/3.3/Dockerfile.c10s b/3.3/Dockerfile.c10s index edd3c2d6..6bd0f44b 100644 --- a/3.3/Dockerfile.c10s +++ b/3.3/Dockerfile.c10s @@ -1,21 +1,16 @@ -FROM quay.io/sclorg/s2i-base-c10s:c10s - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM quay.io/sclorg/s2i-base-c10s:c10s EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=3 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" +ENV RUBY_VERSION="3.3" -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="sclorg/ruby-${RUBY_SCL_NAME_VERSION}-c10s" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-33" \ + IMAGE_NAME="sclorg/ruby-33-c10s" \ + SUMMARY="Platform for building and running Ruby 3.3 applications." \ + DESCRIPTION="Ruby 3.3 available as container is a base platform for \ +building and running various Ruby 3.3 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,26 +18,17 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 3.3" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby33,ruby-33" \ + com.redhat.component="ruby-33-container" \ + name="sclorg/ruby-33-c10s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - ruby-bundled-gems \ - redhat-rpm-config \ - " && \ +RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems redhat-rpm-config libffi-devel" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ dnf reinstall -y --setopt=tsflags=nodocs tzdata && \ dnf -y clean all --enablerepo='*' && \ diff --git a/3.3/Dockerfile.c9s b/3.3/Dockerfile.c9s deleted file mode 100644 index d12412bb..00000000 --- a/3.3/Dockerfile.c9s +++ /dev/null @@ -1,66 +0,0 @@ -FROM quay.io/sclorg/s2i-base-c9s:c9s - -# This image provides a Ruby environment you can use to run your Ruby -# applications. - -EXPOSE 8080 - -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=3 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" - -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi8/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ -Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ -It has many features to process text files and to do system management tasks (as in Perl). \ -It is simple, straight-forward, and extensible." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ ---context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ - maintainer="SoftwareCollections.org " - -RUN dnf -y module enable ruby:$RUBY_VERSION && \ - INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - ruby-bundled-gems \ - redhat-rpm-config \ - " && \ - dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - dnf reinstall -y --setopt=tsflags=nodocs tzdata && \ - dnf -y clean all --enablerepo='*' && \ - ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ - rpm -V ${INSTALL_PKGS} - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/3.3/Dockerfile.fedora b/3.3/Dockerfile.fedora index bd2d64fd..e6e71b8f 100644 --- a/3.3/Dockerfile.fedora +++ b/3.3/Dockerfile.fedora @@ -1,18 +1,16 @@ -FROM quay.io/fedora/s2i-base:40 - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM quay.io/fedora/s2i-base:40 EXPOSE 8080 -ENV NAME=ruby \ - RUBY_VERSION=3.3 \ - RUBY_SHORT_VER=33 \ - VERSION= +ENV RUBY_VERSION="3.3" -ENV SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-33" \ + IMAGE_NAME="fedora/ruby-33" \ + SUMMARY="Platform for building and running Ruby 3.3 applications." \ + DESCRIPTION="Ruby 3.3 available as container is a base platform for \ +building and running various Ruby 3.3 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -20,21 +18,21 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 3.3" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SHORT_VER}" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME-$RUBY_SHORT_VER" \ + io.openshift.tags="builder,ruby,ruby33,ruby-33" \ + com.redhat.component="ruby-33-container" \ + name="fedora/ruby-33" \ version="0" \ - usage="s2i build https://github.com/sclorg/s2i-ruby-container.git --context-dir=${RUBY_VERSION}/test/puma-test-app/ quay.io/fedora/$NAME-$RUBY_SHORT_VER ruby-sample-app" \ + usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ +--context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -# Install required packages RUN INSTALL_PKGS="ruby ruby-devel rubygem-bundler ruby-bundled-gems rubygem-rake rubygems-devel redhat-rpm-config libffi-devel" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + dnf -y clean all --enablerepo='*' && \ ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ - dnf clean all + rpm -V ${INSTALL_PKGS} # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH diff --git a/3.3/Dockerfile.rhel10 b/3.3/Dockerfile.rhel10 index ef0edbd7..9c5d6f4b 100644 --- a/3.3/Dockerfile.rhel10 +++ b/3.3/Dockerfile.rhel10 @@ -1,21 +1,16 @@ -FROM ubi10/s2i-base - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM ubi10/s2i-base EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=3 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" +ENV RUBY_VERSION="3.3" -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi10/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-33" \ + IMAGE_NAME="ubi10/ruby-33" \ + SUMMARY="Platform for building and running Ruby 3.3 applications." \ + DESCRIPTION="Ruby 3.3 available as container is a base platform for \ +building and running various Ruby 3.3 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,25 +18,17 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 3.3" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby33,ruby-33" \ + com.redhat.component="ruby-33-container" \ + name="ubi10/ruby-33" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - ruby-bundled-gems \ - redhat-rpm-config \ - " && \ +RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems redhat-rpm-config libffi-devel" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ dnf reinstall -y --setopt=tsflags=nodocs tzdata && \ dnf -y clean all --enablerepo='*' && \ diff --git a/3.3/Dockerfile.rhel8 b/3.3/Dockerfile.rhel8 index 930bf782..7ae82a0d 100644 --- a/3.3/Dockerfile.rhel8 +++ b/3.3/Dockerfile.rhel8 @@ -1,21 +1,16 @@ -FROM ubi8/s2i-base - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM ubi8/s2i-base EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=3 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" +ENV RUBY_VERSION="3.3" -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi8/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-33" \ + IMAGE_NAME="ubi8/ruby-33" \ + SUMMARY="Platform for building and running Ruby 3.3 applications." \ + DESCRIPTION="Ruby 3.3 available as container is a base platform for \ +building and running various Ruby 3.3 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,29 +18,21 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 3.3" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby33,ruby-33" \ + com.redhat.component="ruby-33-container" \ + name="ubi8/ruby-33" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN yum -y module enable ruby:$RUBY_VERSION && \ - INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - ruby-bundled-gems \ - redhat-rpm-config \ - " && \ - yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - yum -y clean all --enablerepo='*' && \ +RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems redhat-rpm-config libffi-devel" && \ + dnf module enable -y ruby:3.3 && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + dnf -y clean all --enablerepo='*' && \ ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ rpm -V ${INSTALL_PKGS} diff --git a/3.3/Dockerfile.rhel9 b/3.3/Dockerfile.rhel9 index 61bc8907..fb0c139f 100644 --- a/3.3/Dockerfile.rhel9 +++ b/3.3/Dockerfile.rhel9 @@ -1,21 +1,16 @@ -FROM ubi9/s2i-base - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM ubi9/s2i-base EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=3 \ - RUBY_MINOR_VERSION=3 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" +ENV RUBY_VERSION="3.3" -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi9/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-33" \ + IMAGE_NAME="ubi9/ruby-33" \ + SUMMARY="Platform for building and running Ruby 3.3 applications." \ + DESCRIPTION="Ruby 3.3 available as container is a base platform for \ +building and running various Ruby 3.3 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,27 +18,19 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 3.3" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby33,ruby-33" \ + com.redhat.component="ruby-33-container" \ + name="ubi9/ruby-33" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN dnf -y module enable ruby:$RUBY_VERSION && \ - INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - ruby-bundled-gems \ - redhat-rpm-config \ - " && \ +RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems redhat-rpm-config libffi-devel" && \ + dnf module enable -y ruby:3.3 && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ dnf -y clean all --enablerepo='*' && \ ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ diff --git a/3.3/README.md b/3.3/README.md index 00d7dba8..596b00c4 100644 --- a/3.3/README.md +++ b/3.3/README.md @@ -27,7 +27,7 @@ See [the Red Hat Enterprise Linux Application Streams Life Cycle page](https://a Usage in Openshift ------------------ -For this, we will assume that you are using the `ubi10/ruby-33 image`, available via `ruby:3.3` imagestream tag in Openshift. +For this, we will assume that you are using the `registry.access.redhat.com/ubi10/ruby-33` image, available via `ruby:3.3` imagestream tag in Openshift. Building a simple [ruby-sample-app](https://github.com/sclorg/s2i-ruby-container/tree/master/3.3/test/puma-test-app) application in Openshift can be achieved with the following step: @@ -66,10 +66,10 @@ To use the Ruby image in a Dockerfile, follow these steps: #### 1. Pull a base builder image to build on ``` -podman pull ubi10/ruby-33 +podman pull registry.access.redhat.com/ubi10/ruby-33 ``` -An RHEL10 image `ubi10/ruby-33` is used in this example. +The `registry.access.redhat.com/ubi10/ruby-33` container image is used in this example. #### 2. Pull and application code @@ -87,11 +87,11 @@ This step usually consists of at least these parts: * installing the dependencies * setting the default command in the resulting image -For all these three parts, users can use the Source-to-Image scripts inside the image ([3.3.](#33-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content)), or users can either setup all manually and use commands `ruby`, `bundle` and `rackup` explicitly in the Dockerfile ([3.3.](#33-to-use-your-own-setup-create-a-dockerfile-with-this-content)) +For all these three parts, users can use the Source-to-Image scripts inside the image ([3.1.](#31-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content)), or users can either setup all manually and use commands `ruby`, `bundle` and `rackup` explicitly in the Dockerfile ([3.2.](#32-to-use-your-own-setup-create-a-dockerfile-with-this-content)) -##### 3.3 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: +##### 3.1 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: ``` -FROM ubi10/ruby-33 +FROM registry.access.redhat.com/ubi10/ruby-33 # Add application sources to a directory that the assemble scriptexpects them # and set permissions so that the container runs without root access @@ -110,13 +110,14 @@ RUN /usr/libexec/s2i/assemble CMD /usr/libexec/s2i/run ``` The s2i scripts are used to set-up and run common Ruby applications. More information about the scripts can be found in [Source-to-Image](#source-to-image-framework-and-scripts) section. -##### 3.3 To use your own setup, create a Dockerfile with this content: +##### 3.2 To use your own setup, create a Dockerfile with this content: ``` -FROM ubi10/ruby-33 +FROM registry.access.redhat.com/ubi10/ruby-33 USER 0 ADD app-src ./ -RUN bundle install --path ./bundle +RUN bundle config set --local path ./bundle && \ + bundle install CMD bundle exec "rackup -P /tmp/rack.pid --host 0.0.0.0 --port 8080" ``` @@ -227,5 +228,6 @@ See also -------- Dockerfile and other sources are available on https://github.com/sclorg/s2i-ruby-container. In that repository you also can find another versions of Ruby environment Dockerfiles. -The Dockerfile for RHEL8 is called `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, -for RHEL10 it's `Dockerfile.rhel10`, for CentOS Stream 10 it's `Dockerfile.c10s` and the Fedora Dockerfile is called Dockerfile.fedora. +Dockerfile for RHEL8 is called `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, +for CentOS Stream 9 it's `Dockerfile.c9s`, for CentOS Stream 10 it's `Dockerfile.c10s`, +and the Fedora Dockerfile is called `Dockerfile.fedora`. diff --git a/4.0/Dockerfile.c10s b/4.0/Dockerfile.c10s index a3e7d0dc..865bc95e 100644 --- a/4.0/Dockerfile.c10s +++ b/4.0/Dockerfile.c10s @@ -1,21 +1,16 @@ -FROM quay.io/sclorg/s2i-base-c10s:c10s - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM quay.io/sclorg/s2i-base-c10s:c10s EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=4 \ - RUBY_MINOR_VERSION=0 +ENV RUBY_VERSION="4.0" -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" - -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="sclorg/ruby-${RUBY_SCL_NAME_VERSION}-c10s" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-40" \ + IMAGE_NAME="sclorg/ruby-40-c10s" \ + SUMMARY="Platform for building and running Ruby 4.0 applications." \ + DESCRIPTION="Ruby 4.0 available as container is a base platform for \ +building and running various Ruby 4.0 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,23 +18,17 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 4.0" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby40,ruby-40" \ + com.redhat.component="ruby-40-container" \ + name="sclorg/ruby-40-c10s" \ version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN INSTALL_PKGS=" \ - libffi-devel \ - ruby4.0 \ - ruby4.0-devel \ - redhat-rpm-config \ - " && \ +RUN INSTALL_PKGS="ruby4.0 ruby4.0-devel redhat-rpm-config libffi-devel" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ dnf reinstall -y --setopt=tsflags=nodocs tzdata && \ dnf -y clean all --enablerepo='*' && \ @@ -52,7 +41,6 @@ RUN rpm -ql ruby4.0 ruby4.0-devel | \ grep '/usr/bin' | \ xargs --max-args=1 basename -s ${RUBY_VERSION} | \ xargs -I{} ln -s "/usr/bin/{}${RUBY_VERSION}" "/usr/bin/{}" - # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH diff --git a/4.0/Dockerfile.c9s b/4.0/Dockerfile.c9s deleted file mode 100644 index 27b88030..00000000 --- a/4.0/Dockerfile.c9s +++ /dev/null @@ -1,66 +0,0 @@ -FROM quay.io/sclorg/s2i-base-c9s:c9s - -# This image provides a Ruby environment you can use to run your Ruby -# applications. - -EXPOSE 8080 - -ENV RUBY_MAJOR_VERSION=4 \ - RUBY_MINOR_VERSION=0 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" - -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi8/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ -Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ -It has many features to process text files and to do system management tasks (as in Perl). \ -It is simple, straight-forward, and extensible." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ - io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ - version="1" \ - com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ - usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ ---context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ - maintainer="SoftwareCollections.org " - -RUN dnf -y module enable ruby:$RUBY_VERSION && \ - INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - ruby-bundled-gems \ - redhat-rpm-config \ - " && \ - dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ - dnf reinstall -y --setopt=tsflags=nodocs tzdata && \ - dnf -y clean all --enablerepo='*' && \ - ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ - rpm -V ${INSTALL_PKGS} - -# Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH -COPY ./s2i/bin/ $STI_SCRIPTS_PATH - -# Copy extra files to the image. -COPY ./root/ / - -# Drop the root user and make the content of /opt/app-root owned by user 1001 -RUN chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \ - rpm-file-permissions - -USER 1001 - -# Set the default CMD to print the usage of the language image -CMD $STI_SCRIPTS_PATH/usage diff --git a/4.0/Dockerfile.fedora b/4.0/Dockerfile.fedora index 0a71c815..56cb0a1e 100644 --- a/4.0/Dockerfile.fedora +++ b/4.0/Dockerfile.fedora @@ -1,18 +1,16 @@ -FROM quay.io/fedora/s2i-base:44 - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM quay.io/fedora/s2i-base:44 EXPOSE 8080 -ENV NAME=ruby \ - RUBY_VERSION=4.0 \ - RUBY_SHORT_VER=40 \ - VERSION= +ENV RUBY_VERSION="4.0" -ENV SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-40" \ + IMAGE_NAME="fedora/ruby-40" \ + SUMMARY="Platform for building and running Ruby 4.0 applications." \ + DESCRIPTION="Ruby 4.0 available as container is a base platform for \ +building and running various Ruby 4.0 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -20,21 +18,21 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 4.0" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SHORT_VER}" \ - com.redhat.component="$NAME" \ - name="fedora/$NAME-$RUBY_SHORT_VER" \ + io.openshift.tags="builder,ruby,ruby40,ruby-40" \ + com.redhat.component="ruby-40-container" \ + name="fedora/ruby-40" \ version="0" \ - usage="s2i build https://github.com/sclorg/s2i-ruby-container.git --context-dir=${RUBY_VERSION}/test/puma-test-app/ quay.io/fedora/$NAME-$RUBY_SHORT_VER ruby-sample-app" \ + usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ +--context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -# Install required packages RUN INSTALL_PKGS="ruby ruby-devel rubygem-bundler ruby-bundled-gems rubygem-rake rubygems-devel redhat-rpm-config libffi-devel" && \ - dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ - rpm -V $INSTALL_PKGS && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + dnf -y clean all --enablerepo='*' && \ ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ - dnf clean all + rpm -V ${INSTALL_PKGS} # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH diff --git a/4.0/Dockerfile.rhel10 b/4.0/Dockerfile.rhel10 index f2ca3a99..89c743fb 100644 --- a/4.0/Dockerfile.rhel10 +++ b/4.0/Dockerfile.rhel10 @@ -1,21 +1,16 @@ -FROM ubi10/s2i-base - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM ubi10/s2i-base EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=4 \ - RUBY_MINOR_VERSION=0 +ENV RUBY_VERSION="4.0" -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" - -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi10/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-40" \ + IMAGE_NAME="ubi10/ruby-40" \ + SUMMARY="Platform for building and running Ruby 4.0 applications." \ + DESCRIPTION="Ruby 4.0 available as container is a base platform for \ +building and running various Ruby 4.0 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,22 +18,17 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 4.0" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby40,ruby-40" \ + com.redhat.component="ruby-40-container" \ + name="ubi10/ruby-40" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN INSTALL_PKGS=" \ - libffi-devel \ - ruby4.0 \ - ruby4.0-devel \ - redhat-rpm-config \ - " && \ +RUN INSTALL_PKGS="ruby4.0 ruby4.0-devel redhat-rpm-config libffi-devel" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ dnf reinstall -y --setopt=tsflags=nodocs tzdata && \ dnf -y clean all --enablerepo='*' && \ @@ -51,7 +41,6 @@ RUN rpm -ql ruby4.0 ruby4.0-devel | \ grep '/usr/bin' | \ xargs --max-args=1 basename -s ${RUBY_VERSION} | \ xargs -I{} ln -s "/usr/bin/{}${RUBY_VERSION}" "/usr/bin/{}" - # Copy the S2I scripts from the specific language image to $STI_SCRIPTS_PATH COPY ./s2i/bin/ $STI_SCRIPTS_PATH diff --git a/4.0/Dockerfile.rhel9 b/4.0/Dockerfile.rhel9 index dc4b2d5b..8f799533 100644 --- a/4.0/Dockerfile.rhel9 +++ b/4.0/Dockerfile.rhel9 @@ -1,21 +1,16 @@ -FROM ubi9/s2i-base - # This image provides a Ruby environment you can use to run your Ruby # applications. +FROM ubi9/s2i-base EXPOSE 8080 -ENV RUBY_MAJOR_VERSION=4 \ - RUBY_MINOR_VERSION=0 - -ENV RUBY_VERSION="${RUBY_MAJOR_VERSION}.${RUBY_MINOR_VERSION}" \ - RUBY_SCL_NAME_VERSION="${RUBY_MAJOR_VERSION}${RUBY_MINOR_VERSION}" +ENV RUBY_VERSION="4.0" -ENV RUBY_SCL="ruby-${RUBY_SCL_NAME_VERSION}" \ - IMAGE_NAME="ubi9/ruby-${RUBY_SCL_NAME_VERSION}" \ - SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \ - DESCRIPTION="Ruby $RUBY_VERSION available as container is a base platform for \ -building and running various Ruby $RUBY_VERSION applications and frameworks. \ +ENV RUBY_SCL="ruby-40" \ + IMAGE_NAME="ubi9/ruby-40" \ + SUMMARY="Platform for building and running Ruby 4.0 applications." \ + DESCRIPTION="Ruby 4.0 available as container is a base platform for \ +building and running various Ruby 4.0 applications and frameworks. \ Ruby is the interpreted scripting language for quick and easy object-oriented programming. \ It has many features to process text files and to do system management tasks (as in Perl). \ It is simple, straight-forward, and extensible." @@ -23,27 +18,19 @@ It is simple, straight-forward, and extensible." LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="Ruby ${RUBY_VERSION}" \ + io.k8s.display-name="Ruby 4.0" \ io.openshift.expose-services="8080:http" \ - io.openshift.tags="builder,ruby,ruby${RUBY_SCL_NAME_VERSION},${RUBY_SCL}" \ - com.redhat.component="${RUBY_SCL}-container" \ - name="${IMAGE_NAME}" \ + io.openshift.tags="builder,ruby,ruby40,ruby-40" \ + com.redhat.component="ruby-40-container" \ + name="ubi9/ruby-40" \ version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#UBI" \ usage="s2i build https://github.com/sclorg/s2i-ruby-container.git \ --context-dir=${RUBY_VERSION}/test/puma-test-app/ ${IMAGE_NAME} ruby-sample-app" \ maintainer="SoftwareCollections.org " -RUN dnf -y module enable ruby:$RUBY_VERSION && \ - INSTALL_PKGS=" \ - libffi-devel \ - ruby \ - ruby-devel \ - rubygem-rake \ - rubygem-bundler \ - ruby-bundled-gems \ - redhat-rpm-config \ - " && \ +RUN INSTALL_PKGS="ruby ruby-devel rubygem-rake rubygem-bundler ruby-bundled-gems redhat-rpm-config libffi-devel" && \ + dnf module enable -y ruby:4.0 && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ dnf -y clean all --enablerepo='*' && \ ruby -v | grep -qe "^ruby $RUBY_VERSION\." && echo "Found VERSION $RUBY_VERSION" && \ diff --git a/4.0/README.md b/4.0/README.md index 2ce2eff0..88e547c4 100644 --- a/4.0/README.md +++ b/4.0/README.md @@ -27,7 +27,7 @@ See [the Red Hat Enterprise Linux Application Streams Life Cycle page](https://a Usage in Openshift ------------------ -For this, we will assume that you are using the `ubi10/ruby-40` image, available via `ruby:4.0` imagestream tag in Openshift. +For this, we will assume that you are using the `registry.access.redhat.com/ubi10/ruby-40` image, available via `ruby:4.0` imagestream tag in Openshift. Building a simple [ruby-sample-app](https://github.com/sclorg/s2i-ruby-container/tree/master/4.0/test/puma-test-app) application in Openshift can be achieved with the following step: @@ -66,10 +66,10 @@ To use the Ruby image in a Dockerfile, follow these steps: #### 1. Pull a base builder image to build on ``` -podman pull ubi10/ruby-40 +podman pull registry.access.redhat.com/ubi10/ruby-40 ``` -An RHEL10 image `ubi10/ruby-40` is used in this example. +The `registry.access.redhat.com/ubi10/ruby-40` container image is used in this example. #### 2. Pull and application code @@ -87,11 +87,11 @@ This step usually consists of at least these parts: * installing the dependencies * setting the default command in the resulting image -For all these three parts, users can use the Source-to-Image scripts inside the image ([4.0.](#33-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content)), or users can either setup all manually and use commands `ruby`, `bundle` and `rackup` explicitly in the Dockerfile ([4.0.](#33-to-use-your-own-setup-create-a-dockerfile-with-this-content)) +For all these three parts, users can use the Source-to-Image scripts inside the image ([3.1.](#31-to-use-the-source-to-image-scripts-and-build-an-image-using-a-dockerfile-create-a-dockerfile-with-this-content)), or users can either setup all manually and use commands `ruby`, `bundle` and `rackup` explicitly in the Dockerfile ([3.2.](#32-to-use-your-own-setup-create-a-dockerfile-with-this-content)) -##### 4.0 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: +##### 3.1 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content: ``` -FROM ubi10/ruby-40 +FROM registry.access.redhat.com/ubi10/ruby-40 # Add application sources to a directory that the assemble scriptexpects them # and set permissions so that the container runs without root access @@ -110,9 +110,9 @@ RUN /usr/libexec/s2i/assemble CMD /usr/libexec/s2i/run ``` The s2i scripts are used to set-up and run common Ruby applications. More information about the scripts can be found in [Source-to-Image](#source-to-image-framework-and-scripts) section. -##### 4.0 To use your own setup, create a Dockerfile with this content: +##### 3.2 To use your own setup, create a Dockerfile with this content: ``` -FROM ubi10/ruby-40 +FROM registry.access.redhat.com/ubi10/ruby-40 USER 0 ADD app-src ./ @@ -228,5 +228,6 @@ See also -------- Dockerfile and other sources are available on https://github.com/sclorg/s2i-ruby-container. In that repository you also can find another versions of Ruby environment Dockerfiles. -The Dockerfile for RHEL9 is called `Dockerfile.rhel9`, for RHEL10 it's `Dockerfile.rhel10`, -for CentOS Stream 10 it's `Dockerfile.c10s` and the Fedora Dockerfile is called `Dockerfile.fedora`. +Dockerfile for RHEL8 is called `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, +for CentOS Stream 9 it's `Dockerfile.c9s`, for CentOS Stream 10 it's `Dockerfile.c10s`, +and the Fedora Dockerfile is called `Dockerfile.fedora`. From 6f3253ed4daaea0628fa78d398a9c49bf39a6dec Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Thu, 17 Sep 2026 10:57:00 +0200 Subject: [PATCH 13/13] Regenerate version table to reflect distgen reality. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b251f908..fa50f170 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ Currently supported versions are visible in the following table, expand an entry -||CentOS Stream 9|CentOS Stream 10|Fedora|RHEL 8|RHEL 9|RHEL 10| -|:--|:--:|:--:|:--:|:--:|:--:|:--:| -|2.5||||
`registry.redhat.io/rhel8/ruby-25`
||| -|3.0|||||
`registry.redhat.io/rhel9/ruby-30`
|| -|3.3||
`quay.io/sclorg/ruby-33-c10s`
|
`quay.io/fedora/ruby-33`
|
`registry.redhat.io/rhel8/ruby-33`
|
`registry.redhat.io/rhel9/ruby-33`
|
`registry.redhat.io/rhel10/ruby-33`
| -|4.0||
`quay.io/sclorg/ruby-40-c10s`
|
`quay.io/fedora/ruby-40`
||
`registry.redhat.io/rhel9/ruby-40`
|
`registry.redhat.io/rhel10/ruby-40`
| +||CentOS Stream 10|Fedora|RHEL 8|RHEL 9|RHEL 10| +|:--|:--:|:--:|:--:|:--:|:--:| +|2.5|||
`registry.redhat.io/rhel8/ruby-25`
||| +|3.0||||
`registry.redhat.io/rhel9/ruby-30`
|| +|3.3|
`quay.io/sclorg/ruby-33-c10s`
|
`quay.io/fedora/ruby-33`
|
`registry.redhat.io/rhel8/ruby-33`
|
`registry.redhat.io/rhel9/ruby-33`
|
`registry.redhat.io/rhel10/ruby-33`
| +|4.0|
`quay.io/sclorg/ruby-40-c10s`
|
`quay.io/fedora/ruby-40`
||
`registry.redhat.io/rhel9/ruby-40`
|
`registry.redhat.io/rhel10/ruby-40`
|