diff options
-rw-r--r-- | Dockerfile | 18 | ||||
-rw-r--r-- | etc/httpd.conf | 48 | ||||
-rw-r--r-- | etc/httpd.d/documentroot.conf | 1 | ||||
-rwxr-xr-x | s2i/bin/assemble | 31 | ||||
-rwxr-xr-x | s2i/bin/run | 10 |
5 files changed, 25 insertions, 83 deletions
@@ -1,5 +1,5 @@ # kraxel/s2i-jekyll -FROM openshift/base-centos7 +FROM openshift/httpd:24 LABEL maintainer="Gerd Hoffmann <kraxel@redhat.com>" @@ -12,8 +12,7 @@ LABEL io.k8s.description="Platform for building static jekyll sites" \ io.openshift.tags="jekyll,static" RUN yum install -y centos-release-scl && \ - yum install -y httpd \ - rh-ruby${RH_RUBY_VERSION} \ + yum install -y rh-ruby${RH_RUBY_VERSION} \ rh-ruby${RH_RUBY_VERSION}-ruby-devel \ rh-ruby${RH_RUBY_VERSION}-rubygem-bundler && \ yum clean all -y @@ -23,20 +22,7 @@ ENV BASH_ENV="/opt/rh/rh-ruby${RH_RUBY_VERSION}/enable" RUN source /opt/rh/rh-ruby${RH_RUBY_VERSION}/enable; \ gem install jekyll --version "= $JEKYLL_VERSION" -# TODO (optional): Copy the builder files into /opt/app-root -# COPY ./<builder_folder>/ /opt/app-root/ - COPY ./s2i/bin/ /usr/libexec/s2i -COPY ./etc/httpd.conf /opt/app-root/etc -RUN mkdir -p /run/httpd \ - /opt/app-root/run \ - /opt/app-root/log \ - /opt/app-root/html; \ - chmod 1777 /run/httpd \ - /opt/app-root/run \ - /opt/app-root/log; \ - chown -R 1001 /run/httpd \ - /opt/app-root USER 1001 EXPOSE 8080 diff --git a/etc/httpd.conf b/etc/httpd.conf deleted file mode 100644 index 68a9159..0000000 --- a/etc/httpd.conf +++ /dev/null @@ -1,48 +0,0 @@ - -ServerRoot "/etc/httpd" -Include /etc/httpd/conf.modules.d/*.conf - -PidFile "/opt/app-root/run/httpd.pid" -ErrorLog /dev/stderr -TransferLog /dev/stdout -LogLevel warn - -#Listen 80 -Listen 8080 - -User default -Group root - -ServerAdmin root@localhost -#ServerName www.example.com:80 - -DocumentRoot "/opt/app-root/html" -DirectoryIndex index.html -AddDefaultCharset UTF-8 -EnableSendfile on - -<Directory /> - AllowOverride none - Require all denied -</Directory> - -<Directory "/opt/app-root/html"> - AllowOverride All - Options Indexes FollowSymLinks - Require all granted -</Directory> - -<Files ".ht*"> - Require all denied -</Files> - -<IfModule mime_module> - TypesConfig /etc/mime.types - AddType application/x-compress .Z - AddType application/x-gzip .gz .tgz -</IfModule> - -<IfModule mime_magic_module> - MIMEMagicFile conf/magic -</IfModule> - diff --git a/etc/httpd.d/documentroot.conf b/etc/httpd.d/documentroot.conf new file mode 100644 index 0000000..14ce1df --- /dev/null +++ b/etc/httpd.d/documentroot.conf @@ -0,0 +1 @@ +DocumentRoot /opt/app-root/src/html diff --git a/s2i/bin/assemble b/s2i/bin/assemble index 63cdb20..723d4e4 100755 --- a/s2i/bin/assemble +++ b/s2i/bin/assemble @@ -12,31 +12,44 @@ if [[ "$1" == "-h" ]]; then exec /usr/libexec/s2i/usage fi -# Restore artifacts from the previous build (if they exist). -# +set -e + +echo "---> Enabling s2i support in httpd24 image ..." +source ${HTTPD_CONTAINER_SCRIPTS_PATH}/common.sh +config_s2i + if [ "$(ls /tmp/artifacts/ 2>/dev/null)" ]; then - echo "---> Restoring build artifacts..." + echo "---> Restoring build artifacts ..." mv /tmp/artifacts/. ./ fi -echo "---> Installing application source..." +echo "---> Installing application source ..." cp -Rf /tmp/src/. ./ -echo "---> Building application from source..." -set -ex if test -f Gemfile; then + echo "---> Installing packages from Gemfile ..." bundle config path $(pwd)/.gem bundle config bundle install + echo "---> Building jekyll site (gemfile version) ..." bundle exec jekyll build else + echo "---> Building jekyll site (default version) ..." jekyll build fi + if test -f _config.yml; then base=$(awk '/^baseurl/ { print $2 }' _config.yml | tr -d '"') else base="" fi -cd _site -mkdir -p /opt/app-root/html$base -cp -a . /opt/app-root/html$base +dest="${HTTPD_APP_ROOT}/html$base" + +echo "---> Copying pages to $dest ..." +pushd _site +mkdir -p "$dest" +cp -a . "$dest" +popd + +echo "---> Fix permissions ..." +fix-permissions ./ diff --git a/s2i/bin/run b/s2i/bin/run deleted file mode 100755 index ab9c2e0..0000000 --- a/s2i/bin/run +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -e -# -# S2I run script for the 'kraxel/s2i-jekyll' image. -# The run script executes the server that runs your application. -# -# For more information see the documentation: -# https://github.com/openshift/source-to-image/blob/master/docs/builder_image.md -# - -exec /usr/sbin/httpd -f /opt/app-root/etc/httpd.conf -DFOREGROUND |