Add httpd container

Signed-off-by: Qi Zheng <qi.zheng@intel.com>
This commit is contained in:
Qi Zheng
2019-04-06 09:36:28 +08:00
committed by William Douglas
parent b11220d8ee
commit 22a89cd1f9
6 changed files with 86 additions and 0 deletions
+1
View File
@@ -14,6 +14,7 @@ env:
- DOCKERFILE_DIR=postgres
- DOCKERFILE_DIR=nginx
- DOCKERFILE_DIR=redis
- DOCKERFILE_DIR=httpd
script:
- cd $DOCKERFILE_DIR
+1
View File
@@ -8,6 +8,7 @@ https://hub.docker.com/u/clearlinux/
Containers
----------
- clr-sdk
- httpd
- machine-learning
- mixer-ci
- Keystone
+22
View File
@@ -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"]
+57
View File
@@ -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
+4
View File
@@ -0,0 +1,4 @@
#!/bin/sh
set -e
exec httpd -DFOREGROUND
+1
View File
@@ -0,0 +1 @@
<html><body><h1>It works!</h1></body></html>