diff --git a/.gitignore b/.gitignore index 84bad3b..77a8b29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -django-test +src/django-test diff --git a/Dockerfile b/Dockerfile index fa2201c..f266c49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN dnf -y update && \ COPY container-files/httpd-layer/ / -COPY django-test /srv/src/django-test +COPY src/django-test /srv/src/django-test COPY container-files/django-test-layer/ / RUN /srv/bin/setup-django-test.sh /srv/django-test /srv/src/django-test diff --git a/Makefile b/Makefile index 3800a6f..cb66955 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,28 @@ APPLICATION_NAME := django-test -IMAGE_NAME := heinzel/$(APPLICATION_NAME) +REPO_URL := https://heinzelwelt.de/vcs/python/django-test +REPO_DIR := src/$(APPLICATION_NAME) +IMAGE_NAME := $(APPLICATION_NAME) DOCKER := docker +GIT := git -.PHONY: default help image run +.PHONY: default help image test-run dist-clean default: image help: @echo "There is no help." -image: +$(REPO_DIR): + $(GIT) clone $(REPO_URL) $@ + +$(IMAGE_NAME): $(REPO_DIR) $(DOCKER) build -t $(IMAGE_NAME) . +image: $(IMAGE_NAME) + test-run: $(DOCKER) run -ti --rm -p 80:80 $(IMAGE_NAME) + +dist-clean: + -rm -rf $(REPO_DIR) diff --git a/README.rst b/README.rst index e02fc63..e6e2eea 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Docker container for django-test. DESCRIPTION =========== -The docker image is derivated from +The django-heinzel docker image is derivated from Fedora image (https://hub.docker.com/_/fedora). It will contain and run @@ -17,13 +17,17 @@ It will contain and run BUILD ===== -- ``git clone https://heinzelwelt.de/vcs/python/django-test`` +- ``make`` + +or alternatively the *long* way: + +- ``git clone https://heinzelwelt.de/vcs/python/django-test src/django-test`` - ``docker build -t IMAGE_NAME .`` USAGE ===== -- ``docker run -d -p 80:80 -e LOG_LEVEL=error IMAGE_NAME`` +- ``docker run -d -p 80:80 -e SERVER_ADMIN=heinzel@heinzelwelt.de IMAGE_NAME`` The httpd process is listening on port 80/tcp. @@ -35,9 +39,9 @@ CONFIGURATION ============= The following **environment variables** are supported: -- LOG_LEVEL +- LOG_LEVEL (default: error) -- to set the httpd LogLevel directive -- SERVER_ADMIN +- SERVER_ADMIN (default: root@localhost) -- to set the httpd ServerAdmin directive diff --git a/container-files/docker-entrypoint.sh b/container-files/docker-entrypoint.sh index ba9cb24..ee903d6 100755 --- a/container-files/docker-entrypoint.sh +++ b/container-files/docker-entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/sh +DEFAULT_LOG_LEVEL="error" # Disable CustomLog, that is configured by default in upstream. sed -i -e 's:^\(\s*\)\(CustomLog\s\s*"logs/access_log"\):\1# Disabled by /docker-entrypoint.sh # \2:' \ @@ -10,7 +11,5 @@ rm -rf /run/httpd/* /tmp/httpd* if test "X${SERVER_ADMIN}" != "X" ; then set -- -c "ServerAdmin $SERVER_ADMIN" "$@" fi -if test "X${LOG_LEVEL}" != "X" ; then - set -- -c "LogLevel $LOG_LEVEL" "$@" -fi +set -- -c "LogLevel ${LOG_LEVEL:-${DEFAULT_LOG_LEVEL}}" "$@" exec /usr/sbin/httpd -DFOREGROUND "$@"