From 45e4e1e0a3ae5a68cfaaa85a548c38085809734d Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 5 Feb 2020 12:33:19 +0100 Subject: initial commit --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ etc/app-root.conf | 6 ++++++ etc/documentroot.conf | 1 + s2i/bin/assemble | 19 +++++++++++++++++++ s2i/bin/assemble.pre | 12 ++++++++++++ s2i/bin/run | 2 ++ s2i/bin/usage | 4 ++++ 7 files changed, 78 insertions(+) create mode 100644 Dockerfile create mode 100644 etc/app-root.conf create mode 100644 etc/documentroot.conf create mode 100755 s2i/bin/assemble create mode 100755 s2i/bin/assemble.pre create mode 100755 s2i/bin/run create mode 100755 s2i/bin/usage diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0a0212b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,34 @@ +FROM centos:8 + +ENV SUMMARY="httpd base" \ + DESCRIPTION="base image for httpd s2i images" + +LABEL maintainer="Gerd Hoffmann " \ + summary="${SUMMARY}" \ + description="${DESCRIPTION}" \ + io.k8s.display-name="${SUMMARY}" \ + io.k8s.description="${DESCRIPTION}" \ + io.openshift.expose-services="8080:http" \ + io.openshift.tags="httpd" \ + io.openshift.s2i.scripts-url="image:///usr/libexec/s2i" + +USER root + +RUN dnf update -y && \ + dnf install -y httpd && \ + dnf clean all -y + +COPY ./s2i/bin/ /usr/libexec/s2i +COPY ./etc/*.conf /etc/httpd/conf.d/ +RUN mkdir -p /run/httpd;\ + chmod 777 /run/httpd /etc/httpd/logs;\ + sed -i -e '/Listen/s/^/#/' /etc/httpd/conf/httpd.conf;\ + rm -f /etc/httpd/conf.d/welcome.conf +RUN mkdir -p /opt/app-root;\ + chmod 755 /opt /opt/app-root;\ + useradd -d /opt/app-root/src -u 1001 default + +USER 1001 +EXPOSE 8080 + +CMD ["/usr/libexec/s2i/usage"] diff --git a/etc/app-root.conf b/etc/app-root.conf new file mode 100644 index 0000000..2d68317 --- /dev/null +++ b/etc/app-root.conf @@ -0,0 +1,6 @@ +Listen 8080 + + Options Indexes + IndexOptions FancyIndexing NameWidth=* + Require all granted + diff --git a/etc/documentroot.conf b/etc/documentroot.conf new file mode 100644 index 0000000..14ce1df --- /dev/null +++ b/etc/documentroot.conf @@ -0,0 +1 @@ +DocumentRoot /opt/app-root/src/html diff --git a/s2i/bin/assemble b/s2i/bin/assemble new file mode 100755 index 0000000..652b321 --- /dev/null +++ b/s2i/bin/assemble @@ -0,0 +1,19 @@ +#!/bin/bash +# +# For more information refer to the documentation: +# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md +# + +source ${0}.pre + +echo "---> Create hello world page ..." +mkdir html +cat < html/index.html + + hello world +

hello world

+ +EOF + +echo "---> Fix permissions ..." +chmod -R +r html diff --git a/s2i/bin/assemble.pre b/s2i/bin/assemble.pre new file mode 100755 index 0000000..be4477b --- /dev/null +++ b/s2i/bin/assemble.pre @@ -0,0 +1,12 @@ +if [[ "$1" == "-h" ]]; then + exec /usr/libexec/s2i/usage +fi + +set -e + +echo "-=- debug -=-" +(set -x; id -a; pwd) +echo "-=-" + +export HOME=/opt/app-root/src +cd $HOME diff --git a/s2i/bin/run b/s2i/bin/run new file mode 100755 index 0000000..0537f5c --- /dev/null +++ b/s2i/bin/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec /usr/sbin/httpd -D FOREGROUND diff --git a/s2i/bin/usage b/s2i/bin/usage new file mode 100755 index 0000000..fb85d5c --- /dev/null +++ b/s2i/bin/usage @@ -0,0 +1,4 @@ +#!/bin/bash -e +cat <