diff --git a/Makefile b/Makefile index 1ebb4a0..be3f3ae 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,9 @@ rebuild: pull docker build --no-cache -t $(image) . cd build; ./gen-readme.sh $(image) +tag: + docker tag $(image) $(image):$(ARG) + test: .ci/start-ci.sh $(image) $(ARG) diff --git a/README.md b/README.md index eac9df4..978fc8b 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ This Docker container adds a lot of injectables in order to customize it to your | /etc/httpd-custom.d | Mount this directory to add outside configuration files (`*.conf`) to Apache | | /var/www/default | Apache default virtual host base path (contains by default `htdocs/` and `cfg/` | | /shared/httpd | Apache mass virtual host root directory | +| /etc/vhost-gen.d | [vhost-gen](https://github.com/devilbox/vhost-gen) directory for custom templates. Copy and customize [apache22.yml](https://github.com/devilbox/vhost-gen/blob/master/etc/templates/apache22.yml) into this mounted directory for global vhost customizations | #### Default ports diff --git a/data/docker-entrypoint.d/07-vhost-gen.sh b/data/docker-entrypoint.d/07-vhost-gen.sh index 2a122be..44f22ac 100755 --- a/data/docker-entrypoint.d/07-vhost-gen.sh +++ b/data/docker-entrypoint.d/07-vhost-gen.sh @@ -9,6 +9,28 @@ set -o pipefail # Functions ############################################################ +### +### Copy custom vhost-gen template +### +vhost_gen_copy_custom_template() { + local input_dir="${1}" + local output_dir="${2}" + local template_name="${3}" + local debug="${4}" + + if [ ! -d "${input_dir}" ]; then + run "mkdir -p ${input_dir}" "${debug}" + fi + + if [ -f "${input_dir}/${template_name}" ]; then + log "info" "vhost-gen: applying customized global template: ${template_name}" "${debug}" + run "cp ${input_dir}/${template_name} ${output_dir}/${template_name}" "${debug}" + else + log "info" "vhost-gen: no customized template found" "${debug}" + fi +} + + ### ### Set PHP_FPM ### diff --git a/data/docker-entrypoint.sh b/data/docker-entrypoint.sh index 9d787f5..58e39a1 100755 --- a/data/docker-entrypoint.sh +++ b/data/docker-entrypoint.sh @@ -21,6 +21,8 @@ CA_CRT=/ca/devilbox-ca.crt # Path to scripts to source CONFIG_DIR="/docker-entrypoint.d" +VHOST_GEN_DIR="/etc/vhost-gen/templates" +VHOST_GEN_CUST_DIR="/etc/vhost-gen.d" # Wait this many seconds to start watcherd after httpd has been started @@ -123,6 +125,12 @@ fi ## vhost-gen Configuration ############################################################# +### +### Copy custom vhost-gen template +### +vhost_gen_copy_custom_template "${VHOST_GEN_CUST_DIR}" "${VHOST_GEN_DIR}" "apache22.yml" "${DEBUG_LEVEL}" + + ### ### Enable and configure PHP-FPM ###