commit eeeae624e4995ad1c57d10dd47944f030a05c29d Author: heinzel Date: Sun Apr 14 19:34:54 2019 +0200 Initial diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..293decd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM fedora + +LABEL maintainer="Jens Kleineheismann " + +RUN dnf -y update && \ + dnf -y install procps-ng iproute net-tools && \ + dnf -y install haproxy && \ + dnf clean all + +COPY container-filesystem/ / + +EXPOSE 80/tcp + +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["--"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..03b342b --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +APPLICATION_NAME := haproxy +IMAGE_NAME := $(APPLICATION_NAME) + +HOST_PORT := 80 +CONTAINER_PORT := 80 + +DOCKER := docker +DGOSS := dgoss +GIT := git + +.PHONY: default help image test test-run enter + +default: image + +help: + @echo "There is no help." + +$(IMAGE_NAME): + $(DOCKER) build -t $(IMAGE_NAME) . + +image: $(IMAGE_NAME) + +test: + $(DGOSS) run $(IMAGE_NAME) + +test-run: + $(DOCKER) run -ti --rm -p $(HOST_PORT):$(CONTAINER_PORT) $(IMAGE_NAME) + +enter: + $(DOCKER) run -ti --rm -p $(HOST_PORT):$(CONTAINER_PORT) --entrypoint /bin/bash $(IMAGE_NAME) diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..aa6cdaa --- /dev/null +++ b/README.rst @@ -0,0 +1,54 @@ +ABOUT +===== +Docker container for HA-Proxy. + + +AUTHOR +====== +Jens Kleineheismann + + +DESCRIPTION +=========== +This docker image is derivated from the official Fedora image +(https://hub.docker.com/_/fedora). + +It will contain and run + +- haproxy + + +BUILD +===== +- ``make`` +- ``make test`` + +or alternatively the *long* way: + +- ``docker build -t haproxy .`` +- ``dgoss run haproxy`` + + +USAGE +===== +- ``docker run -d -p 80:80 haproxy`` + +The httpd process is listening on port 80/tcp. + +The httpd error log will be written to stderr, so it can be +obtained with ``docker logs`` + + +CONFIGURATION +============= +The following **environment variables** are supported and +can be set with the -e option of the ``docker run`` command: + +- LOG_LEVEL (default: error) + -- to set the httpd LogLevel directive + + +LICENCE +======= +Permission to use, copy, modify, and/or distribute this software +for any purpose with or without fee is hereby granted. diff --git a/container-filesystem/docker-entrypoint.sh b/container-filesystem/docker-entrypoint.sh new file mode 100755 index 0000000..7f7e719 --- /dev/null +++ b/container-filesystem/docker-entrypoint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Remove left-overs from an incomplete shutdown previously. +rm -rf /run/httpd/* /tmp/httpd* + +exec /usr/sbin/httpd \ + -DFOREGROUND \ + -c "LogLevel ${LOG_LEVEL:-error}" \ + -c "ServerName ${HOSTNAME}" \ + "$@" diff --git a/container-filesystem/etc/bashrc.local b/container-filesystem/etc/bashrc.local new file mode 100644 index 0000000..e5993f9 --- /dev/null +++ b/container-filesystem/etc/bashrc.local @@ -0,0 +1,9 @@ +# /etc/bashrc.local + +PS1='\u@\w/ \$ ' +export PS1 + +alias ls="ls -F --color" +alias l="ls -ahl" + +#end