Skip to content

Commit

Permalink
Fix sources in version 5.38 to use proper Perl version
Browse files Browse the repository at this point in the history
  • Loading branch information
jplesnik committed Aug 30, 2023
1 parent 74f419a commit 6c32da2
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 20 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ jobs:
quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME"
quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN"

- dockerfile: "5.38/Dockerfile.fedora"
docker_context: "5.38"
registry_namespace: "fedora"
tag: "5.38"
image_name: "perl-538"
quayio_username: "QUAY_IMAGE_FEDORA_BUILDER_USERNAME"
quayio_token: "QUAY_IMAGE_FEDORA_BUILDER_TOKEN"

steps:
- name: Build and push to quay.io registry
uses: sclorg/build-and-push-action@v4
Expand Down
8 changes: 4 additions & 4 deletions 5.38/Dockerfile.c9s
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM quay.io/sclorg/s2i-base-c9s:c9s

# This image provides a Perl 5.36 environment you can use to run your Perl applications.
# This image provides a Perl 5.38 environment you can use to run your Perl applications.

EXPOSE 8080

# Image metadata
ENV PERL_VERSION=5.36 \
PERL_SHORT_VER=536 \
ENV PERL_VERSION=5.38 \
PERL_SHORT_VER=538 \
NAME=perl

ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \
Expand Down Expand Up @@ -37,7 +37,7 @@ LABEL summary="$SUMMARY" \
# Deselect a default stream
RUN INSTALL_PKGS="perl perl-devel mod_fcgid perl-App-cpanminus perl-FCGI patch" && \
yum -y --allowerasing distrosync && \
yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
perl -v | grep -qe "v$PERL_VERSION\." && echo "Found VERSION $PERL_VERSION" && \
yum -y clean all --enablerepo='*'
Expand Down
9 changes: 4 additions & 5 deletions 5.38/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM quay.io/fedora/s2i-base:38
FROM quay.io/fedora/s2i-base:39

# This image provides a Perl 5.36 environment you can use to run your Perl applications.
# This image provides a Perl 5.38 environment you can use to run your Perl applications.
EXPOSE 8080

# Image metadata
ENV PERL_VERSION=5.36 \
PERL_SHORT_VER=536 \
ENV PERL_VERSION=5.38 \
PERL_SHORT_VER=538 \
VERSION=0 \
NAME=perl \
PATH=/opt/app-root/src/extlib/bin:$PATH \
Expand Down Expand Up @@ -36,7 +36,6 @@ LABEL summary="$SUMMARY" \
usage="s2i build <SOURCE-REPOSITORY> quay.io/fedora/fedora/$NAME-$PERL_SHORT_VER <APP-NAME>"

RUN INSTALL_PKGS="perl perl-devel mod_fcgid perl-App-cpanminus perl-FCGI patch" && \
dnf -y module enable perl:$PERL_VERSION && \
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
perl -v | grep -qe "v$PERL_VERSION\." && echo "Found VERSION $PERL_VERSION" && \
Expand Down
20 changes: 10 additions & 10 deletions 5.38/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Perl 5.36 container image
Perl 5.38 container image
=========================

This container image includes Perl 5.36 as an [S2I](https://github.com/openshift/source-to-image) base image for your Perl 5.36 applications.
This container image includes Perl 5.38 as an [S2I](https://github.com/openshift/source-to-image) base image for your Perl 5.38 applications.
Users can choose Fedora based builder image.
The Fedora images are available in [Quay.io](https://quay.io/fedora/).
The resulting image can be run using [podman](https://github.com/containers/libpod).
Expand All @@ -11,8 +11,8 @@ Note: while the examples in this README are calling `podman`, you can replace an
Description
-----------

Perl 5.36 available as container is a base platform for
building and running various Perl 5.36 applications and frameworks.
Perl 5.38 available as container is a base platform for
building and running various Perl 5.38 applications and frameworks.
Perl is a high-level programming language with roots in C, sed, awk and shell scripting.
Perl is good at handling processes and files, and is especially good at handling text.
Perl's hallmarks are practicality and efficiency. While it is used to do a lot of
Expand All @@ -26,11 +26,11 @@ version, that is included in the image; those versions can be changed anytime.
Usage in Openshift
------------------

In this example, we will assume that you are using the `ubi9/perl-536` image, available via `perl:5.36` imagestream tag in Openshift.
In this example, we will assume that you are using the `ubi9/perl-538` image, available via `perl:5.38` imagestream tag in Openshift.
To build a simple [perl-sample-app](https://github.com/sclorg/dancer-ex.git) application in Openshift:

```
oc new-app perl:5.36~https://github.com/sclorg/dancer-ex.git
oc new-app perl:5.38~https://github.com/sclorg/dancer-ex.git
```

**To access the application:**
Expand Down Expand Up @@ -67,10 +67,10 @@ To use the Perl image in a Dockerfile, follow these steps:
#### 1. Pull a base builder image to build on

```
podman pull ubi9/perl-536
podman pull ubi9/perl-538
```

An ubi9 image `ubi9/perl-536` is used in this example.
An ubi9 image `ubi9/perl-538` is used in this example.

#### 2. Pull and application code

Expand All @@ -93,7 +93,7 @@ For all these three parts, users can either setup all manually and use commands
##### 3.1 To use your own setup, create a Dockerfile with this content:

```
FROM ubi9/perl-536
FROM ubi9/perl-538
# Add application sources
ADD app-src .
Expand Down Expand Up @@ -130,7 +130,7 @@ CMD exec httpd -C 'Include /opt/app-root/etc/httpd.conf' -D FOREGROUND
##### 3.2 To use the Source-to-Image scripts and build an image using a Dockerfile, create a Dockerfile with this content:

```
FROM ubi9/perl-536
FROM ubi9/perl-538
# Add application sources to a directory that the assemble scriptexpects them
# and set permissions so that the container runs without root access
Expand Down
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 = perl
VERSIONS = 5.26-mod_fcgid 5.26 5.30-mod_fcgid 5.30 5.32 5.34 5.36
VERSIONS = 5.26-mod_fcgid 5.26 5.30-mod_fcgid 5.30 5.32 5.34 5.36 5.38
OPENSHIFT_NAMESPACES = 5.16

# HACK: Ensure that 'git pull' for old clones doesn't cause confusion.
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Images available on Quay are:
* Fedora [perl-5.32](https://quay.io/repository/fedora/perl-532)
* Fedora [perl-5.34](https://quay.io/repository/fedora/perl-534)
* Fedora [perl-5.36](https://quay.io/repository/fedora/perl-536)
* Fedora [perl-5.38](https://quay.io/repository/fedora/perl-538)

This repository contains the source for building various versions of
the Perl application as a reproducible container image using
Expand All @@ -34,6 +35,7 @@ Perl versions currently provided:
* [perl-5.32](5.32)
* [perl-5.34](5.34)
* [perl-5.36](5.36)
* [perl-5.38](5.38)

RHEL versions currently supported:
* RHEL7
Expand Down Expand Up @@ -107,6 +109,9 @@ see [usage documentation](5.34/README.md).
For information about usage of the Dockerfile for Perl 5.36 - mod_fcgid version,
see [usage documentation](5.36/README.md).
For information about usage of the Dockerfile for Perl 5.38 - mod_fcgid version,
see [usage documentation](5.38/README.md).
Test
----
This repository also provides a [S2I](https://github.com/openshift/source-to-image) test framework,
Expand Down
32 changes: 32 additions & 0 deletions examples/from-dockerfile/5.38/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ubi9/perl-538

# Add application sources
ADD app-src .

# Set the paths to local Perl modules
ENV PATH=/opt/app-root/src/extlib/bin:${PATH}
ENV PERL5LIB=/opt/app-root/src/extlib/lib/perl5

# Install the dependencies
RUN cpanm --notest -l extlib Module::CoreList && \
cpanm --notest -l extlib --installdeps .

# Install Plack as an FCGI server
RUN cpanm --notest -l extlib Plack::Handler::FCGI FCGI::ProcManager
RUN patch --read-only=ignore -d ./extlib/lib/perl5 -p2 < /opt/app-root/Plack-1.0047-Work-around-mod_fcgid-bogus-SCRIPT_NAME-PATH_INFO.patch
RUN printf '\
FcgidInitialEnv MODFCGID_VIRTUAL_LOCATION /\n\
PassEnv HOME\n\
FcgidInitialEnv "HOME" "%s"\n\
PassEnv PATH\n\
FcgidInitialEnv "PATH" "%s"\n\
PassEnv PERL5LIB\n\
FcgidInitialEnv "PERL5LIB" "%s"\n\
<Location />\n\
SetHandler fcgid-script\n\
Options +ExecCGI\n\
FcgidWrapper "/opt/app-root/psgiwrapper /usr/bin/env plackup -s FCGI ./app.psgi" virtual\n\
</Location>\n' "$HOME" "$PATH" "$PERL5LIB"> /opt/app-root/etc/httpd.d/40-psgi.conf

# Run scripts uses standard ways to run the application
CMD exec httpd -C 'Include /opt/app-root/etc/httpd.conf' -D FOREGROUND
14 changes: 14 additions & 0 deletions examples/from-dockerfile/5.38/Dockerfile.s2i
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM ubi9/perl-538

# Add application sources to a directory that the assemble script expects 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

# Install the dependencies
RUN /usr/libexec/s2i/assemble

# Set the default command for the resulting image
CMD /usr/libexec/s2i/run
2 changes: 2 additions & 0 deletions test/run-modfcgid
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ test_application() {
version="5.34"
elif [ x"$VERSION" == "x5.36" ]; then
version="5.36"
elif [ x"$VERSION" == "x5.38" ]; then
version="5.38"
fi
test_scl_usage "perl --version" "v${version}."
ct_check_testcase_result $?
Expand Down

0 comments on commit 6c32da2

Please sign in to comment.