Skip to content

Commit

Permalink
Update 3.0 Dockerfiles to actually have ruby 3.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackorp committed Jun 11, 2021
1 parent a213726 commit f022629
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 32 deletions.
4 changes: 2 additions & 2 deletions 3.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ FROM quay.io/centos7/s2i-base-centos7

EXPOSE 8080

ENV RUBY_MAJOR_VERSION=2 \
RUBY_MINOR_VERSION=7
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}"
Expand Down
6 changes: 3 additions & 3 deletions 3.0/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM registry.fedoraproject.org/f33/s2i-base
FROM registry.fedoraproject.org/f34/s2i-base

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

EXPOSE 8080

ENV NAME=ruby \
RUBY_VERSION=2.7 \
RUBY_SHORT_VER=27 \
RUBY_VERSION=3.0 \
RUBY_SHORT_VER=30 \
VERSION=0

ENV SUMMARY="Platform for building and running Ruby $RUBY_VERSION applications" \
Expand Down
4 changes: 2 additions & 2 deletions 3.0/Dockerfile.rhel7
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ FROM rhscl/s2i-base-rhel7

EXPOSE 8080

ENV RUBY_MAJOR_VERSION=2 \
RUBY_MINOR_VERSION=7
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}"
Expand Down
4 changes: 2 additions & 2 deletions 3.0/Dockerfile.rhel8
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ FROM ubi8/s2i-base

EXPOSE 8080

ENV RUBY_MAJOR_VERSION=2 \
RUBY_MINOR_VERSION=7
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}"
Expand Down
22 changes: 11 additions & 11 deletions 3.0/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Ruby 2.7 container image
Ruby 3.0 container image
========================
This container image includes Ruby 2.7 as a [S2I](https://github.com/openshift/source-to-image) base image for your Ruby 2.7 applications.
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.
Users can choose between RHEL, CentOS and Fedora based builder images.
The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/),
the CentOS images are available on [Quay.io](https://quay.io/organization/centos7),
Expand All @@ -12,8 +12,8 @@ Note: while the examples in this README are calling `podman`, you can replace an
Description
-----------

Ruby 2.7 available as container is a base platform for
building and running various Ruby 2.7 applications and frameworks.
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.
Expand All @@ -25,12 +25,12 @@ the nodejs itself is included just to make the npm work.

Usage in Openshift
------------------
For this, we will assume that you are using the `ubi8/ruby-27 image`, available via `ruby:2.7` imagestream tag in Openshift.
Building a simple [ruby-sample-app](https://github.com/sclorg/s2i-ruby-container/tree/master/2.7/test/puma-test-app) application
For this, we will assume that you are using the `ubi8/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:

```
oc new-app ruby:2.7~https://github.com/sclorg/rails-ex.git
oc new-app ruby:3.0~https://github.com/sclorg/rails-ex.git
```

**Accessing the application:**
Expand Down Expand Up @@ -64,10 +64,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-27
podman pull ubi8/ruby-30
```

An RHEL7 image `ubi8/ruby-27` is used in this example.
An RHEL7 image `ubi8/ruby-30` is used in this example.

#### 2. Pull and application code

Expand All @@ -89,7 +89,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-27
FROM ubi8/ruby-30
# Add application sources to a directory that the assemble scriptexpects them
# and set permissions so that the container runs without root access
Expand All @@ -110,7 +110,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-27
FROM ubi8/ruby-30
USER 0
ADD app-src ./
Expand Down
2 changes: 1 addition & 1 deletion 3.0/cccp.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# This is for the purpose of building this container
# on the centos container pipeline.
job-id: ruby-27-centos7
job-id: ruby-30-centos7
2 changes: 1 addition & 1 deletion 3.0/root/opt/app-root/etc/scl_enable
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
#
# This will make scl collection binaries work out of box.
unset BASH_ENV PROMPT_COMMAND ENV
source scl_source enable $NODEJS_SCL rh-ruby27
source scl_source enable $NODEJS_SCL rh-ruby30
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Variables are documented in common/build.sh.
BASE_IMAGE_NAME = ruby
VERSIONS = 2.5 2.6 2.7
VERSIONS = 2.5 2.6 2.7 3.0
OPENSHIFT_NAMESPACES = 2.0
CONU_IMAGE := docker.io/usercont/conu:0.6.2

Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ruby-26-container status: [![Docker Repository on Quay](https://quay.io/reposito

ruby-27-container status: [![Docker Repository on Quay](https://quay.io/repository/centos7/ruby-27-centos7/status "Docker Repository on Quay")](https://quay.io/repository/centos7/ruby-27-centos7)

ruby-30-container status: [![Docker Repository on Quay](https://quay.io/repository/centos7/ruby-30-centos7/status "Docker Repository on Quay")](https://quay.io/repository/centos7/ruby-30-centos7)


This repository contains the source for building various versions of
the Ruby application as a reproducible container image using
Expand All @@ -23,6 +25,7 @@ Ruby versions currently provided are:
* [Ruby 2.5](2.5/README.md)
* [Ruby 2.6](2.6/README.md)
* [Ruby 2.7](2.7/README.md)
* [Ruby 3.0](3.0/README.md)

RHEL versions currently supported are:
* RHEL7
Expand All @@ -41,11 +44,11 @@ To build a Ruby image, choose either the CentOS or RHEL based image:
* **RHEL based image**

These images are available in the
[Red Hat Container Catalog](https://access.redhat.com/containers/#/registry.access.redhat.com/rhscl/ruby-27-rhel7).
[Red Hat Container Catalog](https://access.redhat.com/containers/#/registry.access.redhat.com/rhscl/ruby-30-rhel7).
To download it run:

```
$ podman pull registry.access.redhat.com/rhscl/ruby-27-rhel7
$ podman pull registry.access.redhat.com/rhscl/ruby-30-rhel7
```

To build a RHEL based Ruby image, you need to run the build on a properly
Expand All @@ -54,23 +57,23 @@ To build a Ruby image, choose either the CentOS or RHEL based image:
```
$ git clone --recursive https://github.com/sclorg/s2i-ruby-container.git
$ cd s2i-ruby-container
$ make build TARGET=rhel7 VERSIONS=2.7
$ make build TARGET=rhel7 VERSIONS=3.0
```

* **CentOS based image**

This image is available on DockerHub. To download it run:

```
$ podman pull quay.io/centos7/ruby-27-centos7
$ podman pull quay.io/centos7/ruby-30-centos7
```

To build a Ruby image from scratch run:

```
$ git clone --recursive https://github.com/sclorg/s2i-ruby-container.git
$ cd s2i-ruby-container
$ make build TARGET=centos7 VERSIONS=2.7
$ make build TARGET=centos7 VERSIONS=3.0
```

Note: while the installation steps are calling `podman`, you can replace any such calls by `docker` with the same arguments.
Expand All @@ -92,6 +95,9 @@ see [usage documentation](2.6/README.md).
For information about usage of Dockerfile for Ruby 2.7,
see [usage documentation](2.7/README.md).

For information about usage of Dockerfile for Ruby 3.0,
see [usage documentation](3.0/README.md).


Test
---------------------
Expand All @@ -107,14 +113,14 @@ Users can choose between testing a Ruby test application based on a RHEL or Cent

```
$ cd s2i-ruby-container
$ make test TARGET=rhel7 VERSIONS=2.7
$ make test TARGET=rhel7 VERSIONS=3.0
```

* **CentOS based image**

```
$ cd s2i-ruby-container
$ make test TARGET=centos7 VERSIONS=2.7
$ make test TARGET=centos7 VERSIONS=3.0
```

**Notice: By omitting the `VERSIONS` parameter, the build/test action will be performed
Expand All @@ -137,10 +143,10 @@ Image name structure
------------------------

1. Platform name (lowercase) - ruby
2. Platform version(without dots) - 27
2. Platform version(without dots) - 30
3. Base builder image - centos7/rhel7

Examples: `ruby-27-centos7`, `ruby-27-rhel7`
Examples: `ruby-30-centos7`, `ruby-30-rhel7`


Repository organization
Expand Down

0 comments on commit f022629

Please sign in to comment.