Skip to content

Commit 68b0b56

Browse files
authored
Merge pull request #198 from fila43/scl_enable
enable scl variables
2 parents 8468a1e + ce0e4f2 commit 68b0b56

File tree

12 files changed

+85
-53
lines changed

12 files changed

+85
-53
lines changed

5.26/Dockerfile

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ EXPOSE 8080
77
# Image metadata
88
ENV PERL_VERSION=5.26 \
99
PERL_SHORT_VER=526 \
10-
NAME=perl
10+
NAME=perl \
11+
HTTPD_24=httpd24
1112

1213
ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \
1314
DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \
@@ -16,7 +17,15 @@ Perl is a high-level programming language with roots in C, sed, awk and shell sc
1617
Perl is good at handling processes and files, and is especially good at handling text. \
1718
Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \
1819
different things, Perl's most common applications are system administration utilities \
19-
and web programming."
20+
and web programming." \
21+
PKGG_CONFIG_PATH=/opt/rh/$HTTPD_24/root/usr/lib64/pkgconfig \
22+
PYTHONPATH=/opt/rh/$NODEJS_SCL/root/usr/lib/python2.7/site-packages \
23+
PATH=/opt/rh/$NODEJS_SCL/root/usr/bin:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/local/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/sbin:/opt/app-root/src/extlib/bin \
24+
LD_LIBRARY_PATH=/opt/rh/$NODEJS_SCL/root/usr/lib64:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/lib64:/opt/rh/$HTTPD_24/root/usr/lib64 \
25+
X_SCLS="rh-perl$PERL_SHORT_VER $NODEJS_SCL $HTTPD_24" \
26+
LIBRARY_PATH=/opt/rh/$HTTPD_24/root/usr/lib64 \
27+
MANPATH=/opt/rh/$NODEJS_SCL/root/usr/share/man:/opt/rh/$HTTPD_24/root/usr/share/man:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/share/man \
28+
PERL5LIB=/opt/app-root/src/extlib/lib/perl5
2029

2130
LABEL summary="$SUMMARY" \
2231
description="$DESCRIPTION" \
@@ -49,16 +58,15 @@ COPY ./root/ /
4958
# writeable as OpenShift default security model is to run the container under
5059
# random UID.
5160
RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \
52-
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
53-
chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
61+
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/$HTTPD_24/root/etc/httpd/conf/httpd.conf && \
62+
chmod -R og+rwx /opt/rh/$HTTPD_24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
5463
chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \
5564
rpm-file-permissions
5665

5766
USER 1001
5867

5968
# Enable the SCL for all bash scripts.
60-
ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \
61-
ENV=${APP_ROOT}/etc/scl_enable \
69+
ENV ENV=${APP_ROOT}/etc/scl_enable \
6270
PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable"
6371

6472
# Set the default CMD to print the usage of the language image

5.26/Dockerfile.rhel7

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ EXPOSE 8080
77
# Image metadata
88
ENV PERL_VERSION=5.26 \
99
PERL_SHORT_VER=526 \
10-
NAME=perl
10+
NAME=perl \
11+
HTTPD_24=httpd24
1112

1213
ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \
1314
DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \
@@ -16,7 +17,15 @@ Perl is a high-level programming language with roots in C, sed, awk and shell sc
1617
Perl is good at handling processes and files, and is especially good at handling text. \
1718
Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \
1819
different things, Perl's most common applications are system administration utilities \
19-
and web programming."
20+
and web programming."\
21+
PKGG_CONFIG_PATH=/opt/rh/$HTTPD_24/root/usr/lib64/pkgconfig \
22+
PYTHONPATH=/opt/rh/$NODEJS_SCL/root/usr/lib/python2.7/site-packages \
23+
PATH=/opt/rh/$NODEJS_SCL/root/usr/bin:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/local/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/sbin:/opt/app-root/src/extlib/bin \
24+
LD_LIBRARY_PATH=/opt/rh/$NODEJS_SCL/root/usr/lib64:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/lib64:/opt/rh/$HTTPD_24/root/usr/lib64 \
25+
X_SCLS="rh-perl$PERL_SHORT_VER $NODEJS_SCL $HTTPD_24" \
26+
LIBRARY_PATH=/opt/rh/$HTTPD_24/root/usr/lib64 \
27+
MANPATH=/opt/rh/$NODEJS_SCL/root/usr/share/man:/opt/rh/$HTTPD_24/root/usr/share/man:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/share/man \
28+
PERL5LIB=/opt/app-root/src/extlib/lib/perl5
2029

2130
LABEL summary="$SUMMARY" \
2231
description="$DESCRIPTION" \
@@ -51,16 +60,15 @@ COPY ./root/ /
5160
# writeable as OpenShift default security model is to run the container under
5261
# random UID.
5362
RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \
54-
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
55-
chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
63+
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/$HTTPD_24/root/etc/httpd/conf/httpd.conf && \
64+
chmod -R og+rwx /opt/rh/$HTTPD_24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
5665
chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \
5766
rpm-file-permissions
5867

5968
USER 1001
6069

6170
# Enable the SCL for all bash scripts.
62-
ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \
63-
ENV=${APP_ROOT}/etc/scl_enable \
71+
ENV ENV=${APP_ROOT}/etc/scl_enable \
6472
PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable"
6573

6674
# Set the default CMD to print the usage of the language image

5.26/README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ FROM rhscl/perl-526-rhel7
102102
ADD app-src .
103103
104104
# Install the dependencies
105-
RUN export PATH=${PATH}:/opt/rh/rh-perl526/root/usr/bin/&& \
106-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/rh/rh-perl526/root/usr/lib64 && \
107-
cpanm --notest -l extlib Module::CoreList && \
108-
cpanm --notest -l extlib --installdeps .
105+
RUN cpanm --notest -l extlib Module::CoreList && \
106+
cpanm --notest -l extlib --installdeps .
109107
110108
# Set up web application
111109
CMD sed -i '1i<Location/>' /opt/app-root/etc/httpd.d/40-psgi.conf

5.26/s2i/bin/run

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
set -e
44

5-
# CPAN can install scripts. They should be available from mod_perl too.
6-
export PATH=${PATH}:/opt/app-root/src/extlib/bin
7-
# And we have to set Perl include path too because mod_perl's PerlSwitches
8-
# does not apply to them.
9-
export PERL5LIB=/opt/app-root/src/extlib/lib/perl5
10-
115
# Warning: Please note that this will pass all environment variables available within the
126
# container to mod_perl by means of PerlPassEnv in the env.conf file
137
if [ ! -f /opt/app-root/etc/httpd.d/env.conf ]; then

5.30/Dockerfile

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ EXPOSE 8080
77
# Image metadata
88
ENV PERL_VERSION=5.30 \
99
PERL_SHORT_VER=530 \
10-
NAME=perl
10+
NAME=perl \
11+
HTTPD_24=httpd24
1112

1213
ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \
1314
DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \
@@ -16,7 +17,15 @@ Perl is a high-level programming language with roots in C, sed, awk and shell sc
1617
Perl is good at handling processes and files, and is especially good at handling text. \
1718
Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \
1819
different things, Perl's most common applications are system administration utilities \
19-
and web programming."
20+
and web programming." \
21+
PKG_CONFIG_PATH=/opt/rh/$HTTPD_24/root/usr/lib64/pkgconfig \
22+
PYTHONPATH=/opt/rh/$NODEJS_SCL/root/usr/lib/python2.7/site-packages \
23+
PATH=/opt/rh/$NODEJS_SCL/root/usr/bin:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/local/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/sbin:/opt/app-root/src/extlib/bin \
24+
LD_LIBRARY_PATH=/opt/rh/$NODEJS_SCL/root/usr/lib64:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/lib64:/opt/rh/$HTTPD_24/root/usr/lib64 \
25+
X_SCLS="rh-perl$PERL_SHORT_VER $NODEJS_SCL $HTTPD_24" \
26+
LIBRARY_PATH=/opt/rh/$HTTPD_24/root/usr/lib64 \
27+
MANPATH=/opt/rh/$NODEJS_SCL/root/usr/share/man:/opt/rh/$HTTPD_24/root/usr/share/man:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/share/man \
28+
PERL5LIB=/opt/app-root/src/extlib/lib/perl5
2029

2130
LABEL summary="$SUMMARY" \
2231
description="$DESCRIPTION" \
@@ -49,16 +58,15 @@ COPY ./root/ /
4958
# writeable as OpenShift default security model is to run the container under
5059
# random UID.
5160
RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \
52-
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
53-
chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
61+
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/$HTTPD_24/root/etc/httpd/conf/httpd.conf && \
62+
chmod -R og+rwx /opt/rh/$HTTPD_24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
5463
chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \
5564
rpm-file-permissions
5665

5766
USER 1001
5867

5968
# Enable the SCL for all bash scripts.
60-
ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \
61-
ENV=${APP_ROOT}/etc/scl_enable \
69+
ENV ENV=${APP_ROOT}/etc/scl_enable \
6270
PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable"
6371

6472
# Set the default CMD to print the usage of the language image

5.30/Dockerfile.fedora

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ Perl is a high-level programming language with roots in C, sed, awk and shell sc
1616
Perl is good at handling processes and files, and is especially good at handling text. \
1717
Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \
1818
different things, Perl's most common applications are system administration utilities \
19-
and web programming."
19+
and web programming." \
20+
PATH=$PATH:/opt/app-root/src/extlib/bin \
21+
PERL5LIB=/opt/app-root/src/extlib/lib/perl5
2022

2123
LABEL summary="$SUMMARY" \
2224
description="$DESCRIPTION" \

5.30/Dockerfile.rhel7

+14-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ EXPOSE 8080
77
# Image metadata
88
ENV PERL_VERSION=5.30 \
99
PERL_SHORT_VER=530 \
10-
NAME=perl
10+
NAME=perl \
11+
HTTPD_24=httpd24
1112

1213
ENV SUMMARY="Platform for building and running Perl $PERL_VERSION applications" \
1314
DESCRIPTION="Perl $PERL_VERSION available as container is a base platform for \
@@ -16,7 +17,15 @@ Perl is a high-level programming language with roots in C, sed, awk and shell sc
1617
Perl is good at handling processes and files, and is especially good at handling text. \
1718
Perl's hallmarks are practicality and efficiency. While it is used to do a lot of \
1819
different things, Perl's most common applications are system administration utilities \
19-
and web programming."
20+
and web programming." \
21+
PKGG_CONFIG_PATH=/opt/rh/$HTTPD_24/root/usr/lib64/pkgconfig \
22+
PYTHONPATH=/opt/rh/$NODEJS_SCL/root/usr/lib/python2.7/site-packages \
23+
PATH=/opt/rh/$NODEJS_SCL/root/usr/bin:/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/local/bin:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/bin:/opt/rh/$HTTPD_24/root/usr/sbin:/opt/app-root/src/extlib/bin \
24+
LD_LIBRARY_PATH=/opt/rh/$NODEJS_SCL/root/usr/lib64:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/lib64:/opt/rh/$HTTPD_24/root/usr/lib64 \
25+
X_SCLS="rh-perl$PERL_SHORT_VER $NODEJS_SCL $HTTPD_24" \
26+
LIBRARY_PATH=/opt/rh/$HTTPD_24/root/usr/lib64 \
27+
MANPATH=/opt/rh/$NODEJS_SCL/root/usr/share/man:/opt/rh/$HTTPD_24/root/usr/share/man:/opt/rh/rh-perl$PERL_SHORT_VER/root/usr/share/man \
28+
PERL5LIB=/opt/app-root/src/extlib/lib/perl5
2029

2130
LABEL summary="$SUMMARY" \
2231
description="$DESCRIPTION" \
@@ -51,16 +60,15 @@ COPY ./root/ /
5160
# writeable as OpenShift default security model is to run the container under
5261
# random UID.
5362
RUN mkdir -p ${APP_ROOT}/etc/httpd.d && \
54-
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf && \
55-
chmod -R og+rwx /opt/rh/httpd24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
63+
sed -i -f ${APP_ROOT}/etc/httpdconf.sed /opt/rh/$HTTPD_24/root/etc/httpd/conf/httpd.conf && \
64+
chmod -R og+rwx /opt/rh/$HTTPD_24/root/var/run/httpd ${APP_ROOT}/etc/httpd.d && \
5665
chown -R 1001:0 ${APP_ROOT} && chmod -R ug+rwx ${APP_ROOT} && \
5766
rpm-file-permissions
5867

5968
USER 1001
6069

6170
# Enable the SCL for all bash scripts.
62-
ENV BASH_ENV=${APP_ROOT}/etc/scl_enable \
63-
ENV=${APP_ROOT}/etc/scl_enable \
71+
ENV ENV=${APP_ROOT}/etc/scl_enable \
6472
PROMPT_COMMAND=". ${APP_ROOT}/etc/scl_enable"
6573

6674
# Set the default CMD to print the usage of the language image

5.30/README.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ FROM quay.io/centos7/perl-530-centos7
102102
ADD app-src .
103103
104104
# Install the dependencies
105-
RUN export PATH=${PATH}:/opt/rh/rh-perl530/root/usr/bin/&& \
106-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/rh/rh-perl530/root/usr/lib64 && \
107-
cpanm --notest -l extlib Module::CoreList && \
108-
cpanm --notest -l extlib --installdeps .
105+
RUN cpanm --notest -l extlib Module::CoreList && \
106+
cpanm --notest -l extlib --installdeps .
109107
110108
CMD sed -i '1i<Location/>' /opt/app-root/etc/httpd.d/40-psgi.conf
111109
CMD sed -i '2iSetHandler perl-script' /opt/app-root/etc/httpd.d/40-psgi.conf

5.30/s2i/bin/run

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
set -e
44

5-
# CPAN can install scripts. They should be available from mod_perl too.
6-
export PATH=${PATH}:/opt/app-root/src/extlib/bin
7-
# And we have to set Perl include path too because mod_perl's PerlSwitches
8-
# does not apply to them.
9-
export PERL5LIB=/opt/app-root/src/extlib/lib/perl5
10-
115
# Warning: Please note that this will pass all environment variables available within the
126
# container to mod_perl by means of PerlPassEnv in the env.conf file
137
if [ ! -f /opt/app-root/etc/httpd.d/env.conf ]; then

examples/from-dockerfile/5.26/Dockerfile

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
FROM centos/perl-526-centos7
1+
FROM quay.io/centos7/perl-526-centos7
22

33
# Add application sources
44
ADD app-src \.
55

66

77
# Install dependencies cpanfile required
8-
RUN export PATH=${PATH}:/opt/rh/rh-perl526/root/usr/bin/&& \
9-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/rh/rh-perl526/root/usr/lib64 && \
10-
cpanm --notest -l extlib Module::CoreList && \
8+
RUN cpanm --notest -l extlib Module::CoreList && \
119
cpanm --notest -l extlib --installdeps .
1210

1311
CMD sed -i '1i<Location/>' /opt/app-root/etc/httpd.d/40-psgi.conf

examples/from-dockerfile/5.30/Dockerfile

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
FROM centos/perl-530-centos7
1+
FROM quay.io/centos7/perl-530-centos7
22

33
# Add application sources
44
ADD app-src \.
55

66

77
# Install dependencies cpanfile required
8-
RUN export PATH=${PATH}:/opt/rh/rh-perl530/root/usr/bin/&& \
9-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/rh/rh-perl530/root/usr/lib64 && \
10-
cpanm --notest -l extlib Module::CoreList && \
8+
RUN cpanm --notest -l extlib Module::CoreList && \
119
cpanm --notest -l extlib --installdeps .
1210

1311
CMD sed -i '1i<Location/>' /opt/app-root/etc/httpd.d/40-psgi.conf

test/run

+18
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ test_psgi_variables
2121
test_warningonstderr
2222
test_npm
2323
test_from_dockerfile
24+
test_scl_variables_in_dockerfile
2425
"
2526

2627
source "${test_dir}/test-lib.sh"
@@ -344,6 +345,22 @@ test_npm() {
344345
cleanup
345346
}
346347

348+
function test_scl_variables_in_dockerfile() {
349+
if [ "$OS" == "rhel7" ] || [ "$OS" == "centos7" ]; then
350+
# autocleanup only enabled here as only the following tests so far use it
351+
CID_FILE_DIR=$(mktemp -d)
352+
ct_enable_cleanup
353+
354+
info "Testing variable presence during \`docker exec\`"
355+
ct_check_exec_env_vars
356+
check_result $?
357+
358+
info "Checking if all scl variables are defined in Dockerfile"
359+
ct_check_scl_enable_vars
360+
check_result $?
361+
fi
362+
}
363+
347364
function run_all_tests() {
348365
for test_case in $TEST_LIST; do
349366
: "Running test $test_case ...."
@@ -361,6 +378,7 @@ function run_all_tests() {
361378
[ -n "${FAIL_QUICKLY:-}" ] && return 1
362379
done;
363380
}
381+
364382
function test_from_dockerfile(){
365383
info "Check building using a Dockerfile"
366384
ct_test_app_dockerfile $test_dir/examples/from-dockerfile/${VERSION}/Dockerfile 'https://github.com/sclorg/dancer-ex.git' 'Welcome to your Dancer application on OpenShift' app-src

0 commit comments

Comments
 (0)