diff --git a/.travis.yml b/.travis.yml index 1ddcd30..08b6eff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,7 @@ env: - DOCKERFILE_DIR=postgres - DOCKERFILE_DIR=nginx - DOCKERFILE_DIR=redis + - DOCKERFILE_DIR=httpd script: - cd $DOCKERFILE_DIR diff --git a/README.md b/README.md index ba3e810..00c58bc 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ https://hub.docker.com/u/clearlinux/ Containers ---------- - clr-sdk +- httpd - machine-learning - mixer-ci - Keystone diff --git a/httpd/Dockerfile b/httpd/Dockerfile new file mode 100644 index 0000000..f77375e --- /dev/null +++ b/httpd/Dockerfile @@ -0,0 +1,22 @@ +FROM clearlinux:latest +MAINTAINER qi.zheng@intel.com + +ARG swupd_args + +RUN swupd update $swupd_args \ + && swupd bundle-add httpd $swupd_args \ + && rm -rf /var/lib/swupd/* + +#default configuration on /usr/share/defaults/httpd/httpd.conf +#create folder for default DocumentRoot and LOG/PidFile path +RUN mkdir -p /var/www/html \ + && mkdir -p /var/log/httpd \ + && mkdir -p /run/httpd \ + && mkdir -p /usr/local/bin + +COPY index.html /var/www/html/ +COPY httpd-foreground /usr/local/bin/ +RUN chmod +x /usr/local/bin/httpd-foreground + +EXPOSE 80 +CMD ["httpd-foreground"] diff --git a/httpd/README.md b/httpd/README.md new file mode 100644 index 0000000..0ea4a54 --- /dev/null +++ b/httpd/README.md @@ -0,0 +1,57 @@ +httpd +========== +This provides a Clear Linux* httpd instance. + +Build +----- +``` +docker build -t clearlinux/httpd . +``` + +Or just pull it from Dockerhub +--------------------------- +``` +docker pull clearlinux/httpd +``` + +start a redis instance +----------------------- +``` +docker run --name some-httpd -dit -p 8080:80 clearlinux/httpd +``` + +connecting +--------------------- +``` +curl http://localhost:8080/ # locally +curl http://${server-ip}:8080/ # remotely +``` + +benchmark test using apache ab +--------------------- +Please refer to the [page](https://httpd.apache.org/docs/2.4/programs/ab.html) for details. + +``` +ab -n 25000 -c 50 -k http://${server-ip}:8080/ +``` + + +use customized configuration file +--------------------- +The default conf file on clear Linux* is put on /usr/share/defaults/httpd/httpd.conf. +The /etc/httpd/conf.d/httpd.conf could be used to override the defaul one. +The default DocumentRoot is on /var/www/html/. +Above could be modified dynamically by "docker run -v " option, for example, + +``` +docker run --name some-httpd -dit -p 8080:80 \ + -v /etc/httpd/conf.d:/etc/httpd/conf.d \ + -v $PWD/html:/var/www/html \ + clearlinux/httpd +``` + +Extra Build ARGs +---------------- +- ``swupd_args`` Specifies [SWUPD](https://clearlinux.org/documentation/swupdate_how_to_run_the_updater.html) flags + +Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg diff --git a/httpd/httpd-foreground b/httpd/httpd-foreground new file mode 100644 index 0000000..c0612c2 --- /dev/null +++ b/httpd/httpd-foreground @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +exec httpd -DFOREGROUND diff --git a/httpd/index.html b/httpd/index.html new file mode 100644 index 0000000..f5f1c37 --- /dev/null +++ b/httpd/index.html @@ -0,0 +1 @@ +

It works!