summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-02-05 12:33:19 +0100
committerGerd Hoffmann <kraxel@redhat.com>2020-02-05 12:33:19 +0100
commit45e4e1e0a3ae5a68cfaaa85a548c38085809734d (patch)
tree2bd8ada6881bf635ba5956ab4099272d068eda5d
downloads2i-base-httpd-45e4e1e0a3ae5a68cfaaa85a548c38085809734d.tar.gz
initial commit
-rw-r--r--Dockerfile34
-rw-r--r--etc/app-root.conf6
-rw-r--r--etc/documentroot.conf1
-rwxr-xr-xs2i/bin/assemble19
-rwxr-xr-xs2i/bin/assemble.pre12
-rwxr-xr-xs2i/bin/run2
-rwxr-xr-xs2i/bin/usage4
7 files changed, 78 insertions, 0 deletions
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 <kraxel@redhat.com>" \
+ 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
+<Directory "/opt/app-root/src">
+ Options Indexes
+ IndexOptions FancyIndexing NameWidth=*
+ Require all granted
+</Directory>
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 <<EOF > html/index.html
+<html>
+ <head><title>hello world</title></head>
+ <body><h1>hello world</h1></body>
+</html>
+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 <<EOF
+This is a S2I image, see https://github.com/openshift/source-to-image
+EOF