From 5e617f3a2e6ba5e560f7df184246ca5563db9b29 Mon Sep 17 00:00:00 2001 From: Adnan Abdulhussein Date: Tue, 2 Jun 2015 12:13:47 -0700 Subject: [PATCH] Add apache --- bitnami/apache/Dockerfile | 22 +++++++++++++++++++++ bitnami/apache/README.md | 35 ++++++++++++++++++++++++++++++++++ bitnami/apache/entrypoint.sh | 14 ++++++++++++++ bitnami/apache/post-install.sh | 17 +++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 bitnami/apache/Dockerfile create mode 100644 bitnami/apache/README.md create mode 100755 bitnami/apache/entrypoint.sh create mode 100644 bitnami/apache/post-install.sh diff --git a/bitnami/apache/Dockerfile b/bitnami/apache/Dockerfile new file mode 100644 index 000000000000..8ef2e32c8ad5 --- /dev/null +++ b/bitnami/apache/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu-debootstrap:14.04 +MAINTAINER Bitnami + +ENV BITNAMI_APP_NAME apache +ENV BITNAMI_APP_VERSION 2.4.12-0 +ENV BITNAMI_APP_DIRNAME apache2 + +ADD https://storage.googleapis.com/bitnami-artifacts/install.sh?GoogleAccessId=432889337695-e1gggo94k5qubupjsb35tajs91bdu0hg@developer.gserviceaccount.com&Expires=1434934078&Signature=QNkAu%2F8E2RlalSQy4n1sxMhsGKF%2FVltr6zu65HU6A9H0HKOgl6u9etqy9w6OwD4DsLMxYuy2uymOK3iDc5RbfkAMncKI1zJpxcwRQ4Mt43Oe8PBXKbQYcZ7mQaYPtpnjYblDs1S2p12Pu5NTDJHK2hJ1MrIUYwBup5n60R6OJRI%3D /tmp/install.sh +ADD post-install.sh /post-install.sh + +RUN sh /tmp/install.sh +RUN sh /post-install.sh /usr/local/bitnami/apache2 + +ENV PATH /usr/local/bitnami/apache2/bin:$PATH + +EXPOSE 80 443 +VOLUME ["/logs", "/conf", "/app"] + +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +CMD ["/usr/local/bitnami/apache2/bin/httpd", "-DFOREGROUND", "-f", "/usr/local/bitnami/apache2/conf/httpd.conf"] diff --git a/bitnami/apache/README.md b/bitnami/apache/README.md new file mode 100644 index 000000000000..1cd02a908161 --- /dev/null +++ b/bitnami/apache/README.md @@ -0,0 +1,35 @@ +# Bitnami Apache Docker Container + +## Introduction to Bitnami containers +Bitnami provides easy-to-use, consistently configured, and always up-to-date container images. [Click here](https://bitnami.com) for more information on our packaging approach. + +## What is Apache? +The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. + +## Usage +You can instantiate a Bitnami Apache container by doing: + +``` +HOST_APACHE_HTTP_PORT=8080 +HOST_APACHE_HTTPS_PORT=8443 +HOST_APACHE_CONF_DIR=`pwd`/apache_conf +HOST_APACHE_APP_DIR=`pwd`/app +docker run -it \ + -p $HOST_APACHE_HTTP_PORT:80 \ + -p $HOST_APACHE_HTTPS_PORT:443 \ + -v $HOST_APACHE_CONF_DIR:/conf \ + -v $HOST_APACHE_APP_DIR:/app \ + bitnami/apache +``` + +### Ports +The command above allows you to access Apache via ports 8080 and 8443 (or whatever alternative ports you pick) on the host. These will map to ports 80 and 443 respectively inside the container. + +### Configuration +Apache configuration should live in $HOST_APACHE_CONF_DIR on the host. You can edit files in that directory to change the behavior of Apache running inside the container. + +### Application content +Static content that you wish to be served via Apache should live in $HOST_APACHE_APP_DIR. + +### Logs +By default, without a mapping for /logs specified, the container will send the access and error logs to stdout and stderr respectively. You can optionally map a directory on the host to /logs inside the container (with another -v option); this will write the access and error logs to that directory instead. diff --git a/bitnami/apache/entrypoint.sh b/bitnami/apache/entrypoint.sh new file mode 100755 index 000000000000..a44abd295da9 --- /dev/null +++ b/bitnami/apache/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if [ ! "$(ls -A /conf)" ]; then + cp -r /usr/local/bitnami/apache2/conf.defaults/* /usr/local/bitnami/apache2/conf +fi + +if [ ! "$(ls -A /app)" ]; then + cp -r /usr/local/bitnami/apache2/htdocs.defaults/* /usr/local/bitnami/apache2/htdocs +fi + +# Remove zombie pidfile +rm -f /usr/local/bitnami/apache2/logs/httpd.pid + +exec "$@" diff --git a/bitnami/apache/post-install.sh b/bitnami/apache/post-install.sh new file mode 100644 index 000000000000..06c7707cf660 --- /dev/null +++ b/bitnami/apache/post-install.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +INSTALL_DIR=$1 +cd $INSTALL_DIR + +# Backup default conf/htdocs +mv conf conf.defaults +mv htdocs htdocs.defaults + +# Setup mount point symlinks +ln -s /usr/local/bitnami/apache2/conf /conf +ln -s /usr/local/bitnami/apache2/logs /logs +ln -s /usr/local/bitnami/apache2/htdocs /app + +# Log to stdout +ln -sf /dev/stdout logs/access_log +ln -sf /dev/stderr logs/error_log