|
| 1 | +FROM quay.io/centos/centos:stream10-development AS build |
| 2 | + |
| 3 | +RUN mkdir -p /mnt/rootfs |
| 4 | +RUN MICRO_PKGS="coreutils-single glibc-minimal-langpack" && \ |
| 5 | + INSTALL_PKGS="${MICRO_PKGS} httpd-core mod_ssl findutils hostname nss_wrapper-libs redhat-logos-httpd" && \ |
| 6 | + dnf install --installroot /mnt/rootfs ${INSTALL_PKGS} --releasever 10 --setopt install_weak_deps=false --nodocs -y && \ |
| 7 | + dnf -y --installroot /mnt/rootfs clean all && \ |
| 8 | + rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* |
| 9 | + |
| 10 | +FROM scratch |
| 11 | +# Apache HTTP Server image. |
| 12 | +# |
| 13 | +# Volumes: |
| 14 | +# * /var/www - Datastore for httpd |
| 15 | +# * /var/log/httpd24 - Storage for logs when $HTTPD_LOG_TO_VOLUME is set |
| 16 | +# Environment: |
| 17 | +# * $HTTPD_LOG_TO_VOLUME (optional) - When set, httpd will log into /var/log/httpd24 |
| 18 | + |
| 19 | +ENV HTTPD_VERSION=2.4 \ |
| 20 | + HTTPD_SHORT_VERSION=24 \ |
| 21 | + NAME=httpd |
| 22 | + |
| 23 | +ENV SUMMARY="Platform for running Apache httpd ${HTTPD_VERSION} or building httpd-based application" \ |
| 24 | + DESCRIPTION="Apache httpd ${HTTPD_VERSION} available as container, is a powerful, efficient, \ |
| 25 | +and extensible web server. Apache supports a variety of features, many implemented as compiled modules \ |
| 26 | +which extend the core functionality. \ |
| 27 | +These can range from server-side programming language support to authentication schemes. \ |
| 28 | +Virtual hosting allows one Apache installation to serve many different Web sites." \ |
| 29 | +# The following variables are usually available from parent s2i images \ |
| 30 | + STI_SCRIPTS_PATH=/usr/libexec/s2i \ |
| 31 | + APP_ROOT=/opt/app-root \ |
| 32 | + HOME=/opt/app-root/src \ |
| 33 | + PLATFORM="el10" |
| 34 | + |
| 35 | +LABEL summary="${SUMMARY}" \ |
| 36 | + description="${DESCRIPTION}" \ |
| 37 | + io.k8s.description="${DESCRIPTION}" \ |
| 38 | + io.k8s.display-name="Apache httpd ${HTTPD_VERSION}" \ |
| 39 | + io.openshift.expose-services="8080:http,8443:https" \ |
| 40 | + io.openshift.tags="builder,${NAME},${NAME}-${HTTPD_SHORT_VERSION}" \ |
| 41 | + name="sclorg/${NAME}-${HTTPD_SHORT_VERSION}-micro-c10s" \ |
| 42 | + version="1" \ |
| 43 | + usage="s2i build https://github.com/sclorg/httpd-container.git --context-dir=examples/sample-test-app/ sclorg/${NAME}-${HTTPD_SHORT_VERSION}-micro-c10s sample-server" \ |
| 44 | + maintainer="SoftwareCollections.org <sclorg@redhat.com>" |
| 45 | + |
| 46 | +EXPOSE 8080 |
| 47 | +EXPOSE 8443 |
| 48 | + |
| 49 | +COPY --from=build /mnt/rootfs/ / |
| 50 | + |
| 51 | +ENV HTTPD_CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/httpd/ \ |
| 52 | + HTTPD_APP_ROOT=${APP_ROOT} \ |
| 53 | + HTTPD_CONFIGURATION_PATH=${APP_ROOT}/etc/httpd.d \ |
| 54 | + HTTPD_MAIN_CONF_PATH=/etc/httpd/conf \ |
| 55 | + HTTPD_MAIN_CONF_MODULES_D_PATH=/etc/httpd/conf.modules.d \ |
| 56 | + HTTPD_MAIN_CONF_D_PATH=/etc/httpd/conf.d \ |
| 57 | + HTTPD_TLS_CERT_PATH=/etc/httpd/tls \ |
| 58 | + HTTPD_VAR_RUN=/var/run/httpd \ |
| 59 | + HTTPD_DATA_PATH=/var/www \ |
| 60 | + HTTPD_DATA_ORIG_PATH=/var/www \ |
| 61 | + HTTPD_LOG_PATH=/var/log/httpd |
| 62 | + |
| 63 | +COPY 2.4-micro/s2i/bin/ ${STI_SCRIPTS_PATH} |
| 64 | +COPY 2.4-micro/root / |
| 65 | +COPY 2.4-micro/core-scripts/usr /usr |
| 66 | + |
| 67 | +WORKDIR ${HOME} |
| 68 | + |
| 69 | +RUN useradd -u 1001 -r -g 0 -d ${HOME} -c "Default Application User" default && \ |
| 70 | + chown -R 1001:0 ${APP_ROOT} && \ |
| 71 | + httpd -v | grep -qe "Apache/${HTTPD_VERSION}" && echo "Found VERSION ${HTTPD_VERSION}" && \ |
| 72 | + /usr/libexec/httpd-prepare |
| 73 | + |
| 74 | +USER 1001 |
| 75 | + |
| 76 | +# Not using VOLUME statement since it's not working in OpenShift Online: |
| 77 | +# https://github.com/sclorg/httpd-container/issues/30 |
| 78 | +# VOLUME ["${HTTPD_DATA_PATH}"] |
| 79 | +# VOLUME ["${HTTPD_LOG_PATH}"] |
| 80 | + |
| 81 | +CMD ["/usr/bin/run-httpd"] |
0 commit comments