add haproxy container

Signed-off-by: Gong Sophia <sophia.gong@intel.com>
This commit is contained in:
Gong Sophia
2019-05-06 09:07:55 +08:00
committed by qzheng527
parent 2dfbddfeea
commit 27d2b583bd
5 changed files with 77 additions and 0 deletions
+1
View File
@@ -8,6 +8,7 @@ env:
- DOCKERFILE_DIR=clr-installer-ci
- DOCKERFILE_DIR=clr-sdk
- DOCKERFILE_DIR=elasticsearch
- DOCKERFILE_DIR=haproxy
- DOCKERFILE_DIR=httpd
- DOCKERFILE_DIR=machine-learning-ui
- DOCKERFILE_DIR=machine-learning
+18
View File
@@ -0,0 +1,18 @@
FROM clearlinux:latest
MAINTAINER sophia.gong@intel.com
ARG swupd_args
RUN swupd update --no-boot-update $swupd_args
RUN swupd bundle-add haproxy $swupd_args \
&& rm -rf /var/lib/swupd \
&& mkdir -p /usr/local/etc/haproxy
STOPSIGNAL SIGUSR1
COPY docker-entrypoint.sh /
COPY haproxy.cfg /usr/local/etc/haproxy
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]
+25
View File
@@ -0,0 +1,25 @@
haproxy
==========
This provides a Clear Linux* haproxy instance.
Build
-----
docker build -t clearlinux/haproxy .
Or just pull it from Dockerhub
---------------------------
docker pull clearlinux/haproxy
start a haproxy instance
-----------------------
docker run --name some-haproxy -d -p 8080:80 clearlinux/haproxy
use customized configuration file
---------------------
Since no two users of haproxy are likely to configure it exactly alike, we provide /usr/local/etc/haproxy/haproxy.cfg as an example, user may need to customize their own and override this default. Please refer to [page](https://cbonte.github.io/haproxy-dconv/) for configure details.
Extra Build ARGs
----------------
- ``swupd_args`` Specifies [SWUPD](https://github.com/clearlinux/swupd-client/blob/master/docs/swupd.1.rst#options) flags
Default build args in Docker are on: https://docs.docker.com/engine/reference/builder/#arg
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
set -e
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- haproxy "$@"
fi
if [ "$1" = 'haproxy' ]; then
shift # "haproxy"
# if the user wants "haproxy", let's add a couple useful flags
# -W -- "master-worker mode" (similar to the old "haproxy-systemd-wrapper"; allows for reload via "SIGUSR2")
# -db -- disables background mode
set -- haproxy -W -db "$@"
fi
exec "$@"
+16
View File
@@ -0,0 +1,16 @@
global
daemon
maxconn 256
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:80
default_backend servers
backend servers
server server1 127.0.0.1:8000 maxconn 32