Rebuild docker-entrypoint scripts

This commit is contained in:
cytopia
2018-02-27 09:32:49 +01:00
parent 7d41e38374
commit f5491d91fc
27 changed files with 530 additions and 610 deletions

View File

@@ -46,7 +46,7 @@ RUN set -x \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/devilbox.conf /usr/local/etc/php-fpm.d/zzz-devilbox.conf
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
###

View File

@@ -46,7 +46,7 @@ RUN set -x \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/devilbox.conf /usr/local/etc/php-fpm.d/zzz-devilbox.conf
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
###

View File

@@ -46,7 +46,7 @@ RUN set -x \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/devilbox.conf /usr/local/etc/php-fpm.d/zzz-devilbox.conf
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
###

View File

@@ -46,7 +46,7 @@ RUN set -x \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/devilbox.conf /usr/local/etc/php-fpm.d/zzz-devilbox.conf
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
###

View File

@@ -46,7 +46,7 @@ RUN set -x \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/devilbox.conf /usr/local/etc/php-fpm.d/zzz-devilbox.conf
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
###

View File

@@ -46,7 +46,7 @@ RUN set -x \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/devilbox.conf /usr/local/etc/php-fpm.d/zzz-devilbox.conf
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
###

View File

@@ -1,13 +1,8 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
@@ -18,38 +13,31 @@ set -u
### Log to stdout/stderr
###
log() {
log_lvl="${1}"
log_msg="${2}"
local type="${1}" # ok, warn or err
local message="${2}" # msg to print
local debug="${3}" # 0: only warn and error, >0: ok and info
log_clr_ok="\033[0;32m"
log_clr_info="\033[0;34m"
log_clr_warn="\033[0;33m"
log_clr_err="\033[0;31m"
log_clr_rst="\033[0m"
local clr_ok="\033[0;32m"
local clr_info="\033[0;34m"
local clr_warn="\033[0;33m"
local clr_err="\033[0;31m"
local clr_rst="\033[0m"
if [ "${log_lvl}" = "ok" ]; then
if [ "${DEBUG_LEVEL}" -gt "0" ]; then
printf "${log_clr_ok}[OK] %s${log_clr_rst}\n" "${log_msg}"
if [ "${type}" = "ok" ]; then
if [ "${debug}" -gt "0" ]; then
printf "${clr_ok}[OK] %s${clr_rst}\n" "${message}"
fi
elif [ "${log_lvl}" = "info" ]; then
if [ "${DEBUG_LEVEL}" -gt "0" ]; then
printf "${log_clr_info}[INFO] %s${log_clr_rst}\n" "${log_msg}"
elif [ "${type}" = "info" ]; then
if [ "${debug}" -gt "0" ]; then
printf "${clr_info}[INFO] %s${clr_rst}\n" "${message}"
fi
elif [ "${log_lvl}" = "warn" ]; then
printf "${log_clr_warn}[WARN] %s${log_clr_rst}\n" "${log_msg}" 1>&2 # stdout -> stderr
elif [ "${log_lvl}" = "err" ]; then
printf "${log_clr_err}[ERR] %s${log_clr_rst}\n" "${log_msg}" 1>&2 # stdout -> stderr
elif [ "${type}" = "warn" ]; then
printf "${clr_warn}[WARN] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr
elif [ "${type}" = "err" ]; then
printf "${clr_err}[ERR] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr
else
printf "${log_clr_err}[???] %s${log_clr_rst}\n" "${log_msg}" 1>&2 # stdout -> stderr
printf "${clr_err}[???] %s${clr_rst}\n" "${message}" 1>&2 # stdout -> stderr
fi
unset -v log_lvl
unset -v log_msg
unset -v log_clr_ok
unset -v log_clr_info
unset -v log_clr_warn
unset -v log_clr_err
unset -v log_clr_rst
}
@@ -57,29 +45,25 @@ log() {
### Wrapper for run_run command
###
run() {
run_cmd="${1}"
local cmd="${1}" # command to execute
local debug="${2}" # show commands if debug level > 1
run_clr_red="\033[0;31m"
run_clr_green="\033[0;32m"
run_clr_reset="\033[0m"
local clr_red="\033[0;31m"
local clr_green="\033[0;32m"
local clr_reset="\033[0m"
if [ "${DEBUG_LEVEL}" -gt "1" ]; then
printf "${run_clr_red}%s \$ ${run_clr_green}${run_cmd}${run_clr_reset}\n" "$( whoami )"
if [ "${debug}" -gt "1" ]; then
printf "${clr_red}%s \$ ${clr_green}${cmd}${clr_reset}\n" "$( whoami )"
fi
/bin/sh -c "LANG=C LC_ALL=C ${run_cmd}"
unset -v run_cmd
unset -v run_clr_red
unset -v run_clr_green
unset -v run_clr_reset
/bin/sh -c "LANG=C LC_ALL=C ${cmd}"
}
###
### Is argument an integer?
### Is argument a positive integer?
###
isint() {
echo "${1}" | grep -Eq '^([0-9]|[1-9][0-9]*)$'
test -n "${1##*[!0-9]*}"
}
@@ -87,11 +71,7 @@ isint() {
### Is env variable set?
###
env_set() {
if set | grep "^${1}=" >/dev/null 2>&1; then
return 0
else
return 1
fi
printenv "${1}" >/dev/null 2>&1
}
@@ -99,42 +79,25 @@ env_set() {
### Get env variable by name
###
env_get() {
if ! env_set "${1}"; then
return 1
local env_name="${1}"
# Did we have a default value specified?
if [ "${#}" -gt "1" ]; then
if ! env_set "${env_name}"; then
echo "${2}"
return 0
fi
fi
env_get_value="$( set | grep "^${1}=" | awk -F '=' '{for (i=2; i<NF; i++) printf $i "="; print $NF}' )"
# Remove surrounding quotes
env_get_value="$( echo "${env_get_value}" | sed "s/^'//g" )"
env_get_value="$( echo "${env_get_value}" | sed 's/^"//g' )"
env_get_value="$( echo "${env_get_value}" | sed "s/'$//g" )"
env_get_value="$( echo "${env_get_value}" | sed 's/"$//g' )"
echo "${env_get_value}"
unset -v env_get_value
# Just output the env value
printenv "${1}"
}
############################################################
# Sanity Checks
############################################################
if ! command -v grep >/dev/null 2>&1; then
log "err" "grep not found, but required."
exit 1
fi
if ! command -v sed >/dev/null 2>&1; then
log "err" "sed not found, but required."
exit 1
fi
if ! command -v awk >/dev/null 2>&1; then
log "err" "awk not found, but required."
exit 1
fi
if ! command -v getent >/dev/null 2>&1; then
log "err" "getent not found, but required."
if ! command -v printenv >/dev/null 2>&1; then
log "err" "printenv not found, but required." "1"
exit 1
fi

View File

@@ -1,22 +0,0 @@
#!/bin/sh
set -e
set -u
############################################################
# Functions
############################################################
###
### Debug level
###
get_debug_level() {
if ! env_set "${1}"; then
# Return default specified value
echo "${2}"
else
# Return env value
env_get "${1}"
fi
}

View File

@@ -0,0 +1,125 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
# Functions
############################################################
###
### Helper
###
_get_username_by_uid() {
if getent="$( getent passwd "${1}" )"; then
echo "${getent//:*}"
return 0
fi
return 1
}
_get_groupname_by_gid() {
if getent="$( getent group "${1}" )"; then
echo "${getent//:*}"
return 0
fi
return 1
}
###
### Change UID
###
set_uid() {
local uid_varname="${1}"
local username="${2}"
local homedir="${3}"
local debug="${4}"
local uid= # new uid
local spare_uid=9876 # spare uid to change another user to
if ! env_set "${uid_varname}"; then
log "info" "\$${uid_varname} not set. Keeping default uid for '${username}'." "${debug}"
else
uid="$( env_get "${uid_varname}" )"
if ! isint "${uid}"; then
log "err" "\$${uid_varname} is not an integer: '${uid}'" "${debug}"
exit 1
else
# Username with this uid already exists
if target_username="$( _get_username_by_uid "${uid}" )"; then
# It is not our user, so we need to changes his/her uid to something else first
if [ "${target_username}" != "${username}" ]; then
log "warn" "User with ${uid} already exists: ${target_username}" "${debug}"
log "info" "Changing UID of ${target_username} to ${spare_uid}" "${debug}"
run "usermod -u ${spare_uid} ${target_username}" "${debug}"
fi
fi
# Change uid and fix homedir permissions
log "info" "Changing user '${username}' uid to: ${uid}" "${debug}"
run "usermod -u ${uid} ${username}" "${debug}"
run "chown -R ${username} ${homedir}" "${debug}"
fi
fi
}
###
### Change GID
###
set_gid() {
local gid_varname="${1}"
local groupname="${2}"
local homedir="${3}"
local debug="${4}"
local gid= # new gid
local spare_gid=9876 # spare gid to change another group to
if ! env_set "${gid_varname}"; then
log "info" "\$${gid_varname} not set. Keeping default gid for '${groupname}'." "${debug}"
else
# Retrieve the value from env
gid="$( env_get "${gid_varname}" )"
if ! isint "${gid}"; then
log "err" "\$${gid_varname} is not an integer: '${gid}'" "${debug}"
exit 1
else
# Groupname with this gid already exists
if target_groupname="$( _get_groupname_by_gid "${gid}" )"; then
# It is not our group, so we need to changes his/her gid to something else first
if [ "${target_groupname}" != "${groupname}" ]; then
log "warn" "Group with ${gid} already exists: ${target_groupname}" "${debug}"
log "info" "Changing GID of ${target_groupname} to ${spare_gid}" "${debug}"
run "groupmod -g ${spare_gid} ${target_groupname}" "${debug}"
fi
fi
# Change ugd and fix homedir permissions
log "info" "Changing group '${groupname}' gid to: ${gid}" "${debug}"
run "groupmod -g ${gid} ${groupname}" "${debug}"
run "chown -R :${groupname} ${homedir}" "${debug}"
fi
fi
}
############################################################
# Sanity Checks
############################################################
if ! command -v usermod >/dev/null 2>&1; then
log "err" "usermod not found, but required." "1"
exit 1
fi
if ! command -v groupmod >/dev/null 2>&1; then
log "err" "groupmod not found, but required." "1"
exit 1
fi
if ! command -v getent >/dev/null 2>&1; then
log "err" "getent not found, but required." "1"
exit 1
fi

View File

@@ -1,104 +0,0 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
set -e
set -u
############################################################
# Functions
############################################################
###
### Change UID
###
set_uid() {
uid_varname="${1}"
if ! env_set "${uid_varname}"; then
log "info" "\$${uid_varname} not set. Keeping default uid for '${MY_USER}'."
else
uid_env_uid="$( env_get "${uid_varname}" )"
if ! isint "${uid_env_uid}"; then
log "err" "\$${uid_varname} is not an integer: '${uid_env_uid}'"
exit 1
else
if uid_getent_row="$( getent passwd "${uid_env_uid}" )"; then
uid_getent_name="$( echo "${uid_getent_row}" | awk -F ':' '{print $1}' )"
if [ "${uid_getent_name}" != "${MY_USER}" ]; then
log "warn" "User with ${uid_env_uid} already exists: ${uid_getent_name}"
log "info" "Changing UID of ${uid_getent_name} to 9999"
run "usermod -u 9999 ${uid_getent_name}"
fi
fi
log "info" "Changing user '${MY_USER}' uid to: ${uid_env_uid}"
run "usermod -u ${uid_env_uid} ${MY_USER}"
fi
fi
# Fix homedir permissions
run "chown -R ${MY_USER} /home/${MY_USER}"
unset -v uid_varname
unset -v uid_env_uid
unset -v uid_getent_row
unset -v uid_getent_name
}
###
### Change GID
###
set_gid() {
gid_varname="${1}"
if ! env_set "${gid_varname}"; then
log "info" "\$${gid_varname} not set. Keeping default gid for '${MY_GROUP}'."
else
# Retrieve the value from env
gid_env_gid="$( env_get "${gid_varname}" )"
if ! isint "${gid_env_gid}"; then
log "err" "\$${gid_varname} is not an integer: '${gid_env_gid}'"
exit 1
else
if gid_getent_row="$( getent group "${gid_env_gid}" )"; then
gid_getent_name="$( echo "${gid_getent_row}" | awk -F ':' '{print $1}' )"
if [ "${gid_getent_name}" != "${MY_GROUP}" ]; then
log "warn" "Group with ${gid_env_gid} already exists: ${gid_getent_name}"
log "info" "Changing GID of ${gid_getent_name} to 9999"
run "groupmod -g 9999 ${gid_getent_name}"
fi
fi
log "info" "Changing group '${MY_GROUP}' gid to: ${gid_env_gid}"
run "groupmod -g ${gid_env_gid} ${MY_GROUP}"
fi
fi
# Fix homedir permissions
run "chown -R :${MY_GROUP} /home/${MY_USER}"
unset -v gid_varname
unset -v gid_env_gid
unset -v gid_getent_row
unset -v gid_getent_name
}
############################################################
# Sanity Checks
############################################################
if ! command -v usermod >/dev/null 2>&1; then
log "err" "usermod not found, but required."
exit 1
fi
if ! command -v groupmod >/dev/null 2>&1; then
log "err" "groupmod not found, but required."
exit 1
fi

View File

@@ -1,17 +1,21 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
#!/usr/bin/env bash
###
### Settings
###
set -e
set -u
set -p pipefail
###
### Globals
###
# The following global variables are available by our Dockerfile itself:
# MY_USER
# MY_GROUP
# MY_UID
# MY_GID
# Path to scripts to source
CONFIG_DIR="/docker-entrypoint.d"
@@ -25,27 +29,27 @@ for f in ${init}; do
done
###
### Set Debug level
###
DEBUG_LEVEL="$( get_debug_level "DEBUG_ENTRYPOINT" "0" )"
log "info" "Debug level: ${DEBUG_LEVEL}"
#############################################################
## Entry Point
#############################################################
###
### Set Debug level
###
DEBUG_LEVEL="$( env_get "DEBUG_ENTRYPOINT" "0" )"
log "info" "Debug level: ${DEBUG_LEVEL}" "${DEBUG_LEVEL}"
###
### Change uid/gid
###
set_uid "NEW_UID"
set_gid "NEW_GID"
set_uid "NEW_UID" "${MY_USER}" "/home/${MY_USER}" "${DEBUG_LEVEL}"
set_gid "NEW_GID" "${MY_GROUP}" "/home/${MY_USER}" "${DEBUG_LEVEL}"
###
### Startup
###
log "info" "Starting $( php-fpm -v 2>&1 | head -1 )"
log "info" "Starting $( php-fpm -v 2>&1 | head -1 )" "${DEBUG_LEVEL}"
exec /usr/local/sbin/php-fpm

View File

@@ -1,5 +1,3 @@
[global]
error_log = /proc/self/fd/2
log_level = notice
daemonize = no
include = /usr/local/etc/php-fpm.d/*.conf

View File

@@ -0,0 +1,10 @@
[www]
; Keep env variables set by docker
clear_env = no
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
catch_workers_output = yes

View File

@@ -0,0 +1,3 @@
[www]
; Ensure to listen here
listen = 9000

View File

@@ -0,0 +1,6 @@
[global]
error_log = /proc/self/fd/2
[www]
; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2

View File

@@ -0,0 +1,2 @@
[global]
log_level = notice

View File

@@ -4,9 +4,6 @@
user = devilbox
group = devilbox
; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2
; Ensure to listen here
listen = 9000

View File

@@ -0,0 +1,5 @@
[www]
; User and Group
user = devilbox
group = devilbox

View File

@@ -1,13 +1,8 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
@@ -18,43 +13,33 @@ set -u
### Change Timezone
###
set_timezone() {
tz_env_varname="${1}"
tz_php_ini="${2}"
local env_varname="${1}"
local php_conf_dir="${2}"
local debug="${3}"
local timezone=
if ! env_set "${tz_env_varname}"; then
log "info" "\$${tz_env_varname} not set."
log "info" "Setting PHP: timezone=UTC"
run "sed -i'' 's|^[[:space:]]*;*[[:space:]]*date\.timezone[[:space:]]*=.*$|date.timezone = UTF|g' ${tz_php_ini}"
if ! env_set "${env_varname}"; then
log "info" "\$${env_varname} not set." "${debug}"
# Unix Time
log "info" "Setting container timezone to: UTC" "${debug}"
run "ln -sf /usr/share/zoneinfo/UTC /etc/localtime" "${debug}"
# PHP Time
log "info" "Setting PHP: timezone=UTC" "${debug}"
run "echo 'date.timezone = UTC' > ${php_conf_dir}/devilbox-runtime.ini" "${debug}"
else
tz_timezone="$( env_get "${tz_env_varname}" )"
if [ -f "/usr/share/zoneinfo/${tz_timezone}" ]; then
timezone="$( env_get "${env_varname}" )"
if [ -f "/usr/share/zoneinfo/${timezone}" ]; then
# Unix Time
log "info" "Setting container timezone to: ${tz_timezone}"
run "rm /etc/localtime"
run "ln -s /usr/share/zoneinfo/${tz_timezone} /etc/localtime"
log "info" "Setting container timezone to: ${timezone}" "${debug}"
run "ln -sf /usr/share/zoneinfo/${timezone} /etc/localtime" "${debug}"
# PHP Time
log "info" "Setting PHP: timezone=${tz_timezone}"
run "sed -i'' 's|^[[:space:]]*;*[[:space:]]*date\.timezone[[:space:]]*=.*$|date.timezone = ${tz_timezone}|g' ${tz_php_ini}"
log "info" "Setting PHP: timezone=${timezone}" "${debug}"
run "echo 'date.timezone = ${timezone}' > ${php_conf_dir}/devilbox-runtime.ini" "${debug}"
else
log "err" "Invalid timezone for \$${tz_env_varname}."
log "err" "\$TIMEZONE: '${tz_timezone}' does not exist."
log "err" "Invalid timezone for \$${env_varname}." "${debug}"
log "err" "Timezone '${timezone}' does not exist." "${debug}"
exit 1
fi
fi
log "info" "Docker date set to: $(date)"
unset -v tz_env_varname
unset -v tz_php_ini
unset -v tz_timezone
log "info" "Docker date set to: $(date)" "${debug}"
}
############################################################
# Sanity Checks
############################################################
if ! command -v sed >/dev/null 2>&1; then
echo "sed not found, but required."
exit 1
fi

View File

@@ -1,14 +1,8 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
@@ -19,45 +13,50 @@ set -u
### Setup Postfix for catch-all
###
set_postfix() {
postfix_env_varname="${1}"
local env_varname="${1}"
local username="${2}"
local groupname="${3}"
local debug="${4}"
if ! env_set "${postfix_env_varname}"; then
log "info" "\$${postfix_env_varname} not set."
log "info" "Disabling sending of emails"
local catch_all=
if ! env_set "${env_varname}"; then
log "info" "\$${env_varname} not set." "${debug}"
log "info" "Postfix will not be started." "${debug}"
else
postfix_env_value="$( env_get "${postfix_env_varname}" )"
if [ "${postfix_env_value}" = "1" ]; then
log "info" "Enabling sending of emails"
catch_all="$( env_get "${env_varname}" )"
if [ "${catch_all}" = "1" ]; then
log "info" "Enabling postfix catch-all" "${debug}"
# Add Mail file if it does not exist
if [ ! -f "/var/mail/${MY_USER}" ]; then
run "touch /var/mail/${MY_USER}"
# Add Mail dir/file if it does not exist
if [ ! -d "/var/mail" ]; then
run "mkdir /var/mail" "${debug}"
fi
if [ ! -f "/var/mail/${username}" ]; then
run "touch /var/mail/${username}" "${debug}"
fi
# Fix mail user permissions after mount
run "chmod 0644 /var/mail/${MY_USER}"
run "chown ${MY_USER}:${MY_GROUP} /var/mail"
run "chown ${MY_USER}:${MY_GROUP} /var/mail/${MY_USER}"
# Fix mail dir/file permissions after mount
run "chmod 0644 /var/mail/${username}" "${debug}"
run "chown ${username}:${groupname} /var/mail" "${debug}"
run "chown ${username}:${groupname} /var/mail/${username}" "${debug}"
# Postfix configuration
run "postconf -e 'inet_protocols=ipv4'"
run "postconf -e 'virtual_alias_maps=pcre:/etc/postfix/virtual'"
run "echo '/.*@.*/ ${MY_USER}' >> /etc/postfix/virtual"
run "postconf -e 'inet_protocols=ipv4'" "${debug}"
run "postconf -e 'virtual_alias_maps=pcre:/etc/postfix/virtual'" "${debug}"
run "echo '/.*@.*/ ${username}' >> /etc/postfix/virtual" "${debug}"
run "newaliases"
run "newaliases" "${debug}"
elif [ "${postfix_env_value}" = "0" ]; then
log "info" "Disabling sending of emails."
elif [ "${catch_all}" = "0" ]; then
log "info" "Disabling postfix catch-all" "${debug}"
else
log "err" "Invalid value for \$${postfix_env_varname}"
log "err" "Only 1 (for on) or 0 (for off) are allowed"
log "err" "Invalid value for \$${env_varname}" "${debug}"
log "err" "Only 1 (for on) or 0 (for off) are allowed" "${debug}"
exit 1
fi
fi
unset -v postfix_env_varname
unset -v postfix_env_value
}
@@ -66,6 +65,10 @@ set_postfix() {
############################################################
if ! command -v postconf >/dev/null 2>&1; then
echo "postconf not found, but required."
log "err" "postconf not found, but required." "1"
exit 1
fi
if ! command -v newaliases >/dev/null 2>&1; then
log "err" "newaliases not found, but required." "1"
exit 1
fi

View File

@@ -1,47 +1,48 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
# Helper Functions
############################################################
# Check if PHP-FPM config files contain valid logging directives
_validate_docker_logs() {
vdl_fpm_error_log_conf="${1}"
vdl_fpm_access_log_conf="${2}"
if [ ! -f "${vdl_fpm_error_log_conf}" ]; then
log "err" "PHP-FPM Error log config file does not exist in: ${vdl_fpm_error_log_conf}"
exit 1
fi
if [ ! -f "${vdl_fpm_access_log_conf}" ]; then
log "err" "PHP-FPM Access log config file does not exist in: ${dl_fpm_access_log_conf}"
exit 1
fi
if ! grep -Eq '^error_log.*$' "${vdl_fpm_error_log_conf}"; then
log "err" "PHP-FPM Error log config file has no error logging directive"
exit 1
fi
if ! grep -Eq '^access\.log.*$' "${vdl_fpm_access_log_conf}"; then
log "err" "PHP-FPM Access log config file has no access logging directive"
exit 1
fi
unset -v vdl_fpm_error_log_conf
unset -v vdl_fpm_access_log_conf
_log_to_dockerlogs() {
local conf_logfile="${1}"
{
echo "[global]"
echo "error_log = /proc/self/fd/2"
echo "[www]"
echo "access.log = /proc/self/fd/2"
} > "${conf_logfile}"
}
_log_to_files() {
local conf_logfile="${1}"
local log_dir="${2}"
local user="${3}"
local group="${4}"
local debug="${5}"
# Create Log directory and files
if [ ! -d "${log_dir}" ]; then
run "mkdir -p ${log_dir}" "${debug}"
fi
if [ ! -f "${log_dir}/php-fpm.access" ]; then
run "touch ${log_dir}/php-fpm.access" "${debug}"
fi
if [ ! -f "${log_dir}/php-fpm.error" ]; then
run "touch ${log_dir}/php-fpm.error" "${debug}"
fi
run "chown -R ${user}:${group} ${log_dir}" "${debug}"
{
echo "[global]"
echo "error_log = ${log_dir}/php-fpm.error"
echo "[www]"
echo "access.log = ${log_dir}/php-fpm.access"
} > "${conf_logfile}"
}
############################################################
@@ -49,68 +50,38 @@ _validate_docker_logs() {
############################################################
###
### Change UID
### Change PHP-FPM logging (file or docker logs)
###
set_docker_logs() {
dl_env_varname="${1}"
dl_log_dir="${2}"
dl_fpm_error_log_conf="${3}"
dl_fpm_access_log_conf="${4}"
local env_varname="${1}"
local log_dir="${2}"
local conf_logfile="${3}"
local user="${4}"
local group="${5}"
local debug="${6}"
if ! env_set "${dl_env_varname}"; then
log "info" "\$${dl_env_varname} not set."
log "info" "Logging to docker logs stdout and stderr"
local docker_logs=
if ! env_set "${env_varname}"; then
log "info" "\$${env_varname} not set." "${debug}"
log "info" "Logging to docker logs (stdout and stderr)." "${debug}"
_log_to_dockerlogs "${conf_logfile}"
else
dl_docker_logs="$( env_get "${dl_env_varname}" )"
docker_logs="$( env_get "${env_varname}" )"
# Disable docker logs and log to files
if [ "${dl_docker_logs}" = "0" ]; then
log "info" "\$${dl_env_varname} set to 0. Logging to files under: ${dl_log_dir}"
log "info" "Make sure to mount this directory in order to view logs"
# Validation
_validate_docker_logs "${dl_fpm_error_log_conf}" "${dl_fpm_access_log_conf}"
# Create Log directory
if [ ! -d "${dl_log_dir}" ]; then
run "mkdir -p ${dl_log_dir}"
fi
# Fix permissions (in case uid/gid has changed)
if [ ! -f "${dl_log_dir}/php-fpm.access" ]; then
touch "${dl_log_dir}/php-fpm.access"
fi
if [ ! -f "${dl_log_dir}/php-fpm.error" ]; then
touch "${dl_log_dir}/php-fpm.error"
fi
run "chown -R ${MY_USER}:${MY_GROUP} ${dl_log_dir}"
# Adjust PHP-FPM config to log to file
run "sed -i'' 's|^error_log.*$|error_log = ${dl_log_dir}/php-fpm.error|g' ${dl_fpm_error_log_conf}"
run "sed -i'' 's|^access\.log.*$|access.log = ${dl_log_dir}/php-fpm.access|g' ${dl_fpm_access_log_conf}"
if [ "${docker_logs}" = "0" ]; then
log "info" "\$${env_varname} set to 0. Logging to files under: ${log_dir}" "${debug}"
log "info" "Make sure to mount this directory in order to view logs" "${debug}"
_log_to_files "${conf_logfile}" "${log_dir}" "${user}" "${group}" "${debug}"
# Keep docker logs
elif [ "${dl_docker_logs}" = "1" ]; then
log "info" "\$${dl_env_varname} set to 1. Logging to docker logs stdout and stderr."
elif [ "${docker_logs}" = "1" ]; then
log "info" "\$${env_varname} set to 1. Logging to docker logs (stdout and stderr)."
_log_to_dockerlogs "${conf_logfile}"
else
log "err" "Invalid value for \$${dl_env_varname}. Can only be 0 or 1. Provided: ${dl_docker_logs}"
log "err" "Invalid value for \$${env_varname}. Can only be 0 or 1. Provided: ${docker_logs}"
exit 1
fi
fi
unset -v dl_env_varname
unset -v dl_log_dir
unset -v dl_fpm_error_log_conf
unset -v dl_fpm_access_log_conf
unset -v dl_docker_logs
}
############################################################
# Sanity Checks
############################################################
if ! command -v sed >/dev/null 2>&1; then
echo "sed not found, but required."
exit 1
fi

View File

@@ -1,93 +1,76 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
# Helper Functions
############################################################
###
### Helper functions
###
# Check whether a string is a valid IP address
_isip() {
local o1=
local o2=
local o3=
local o4=
# IP is not in correct format
if ! echo "${1}" | grep -Eq '^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})$'; then
return 1
fi
# Get each octet
isip_o1="$( echo "${1}" | awk -F'.' '{print $1}' )"
isip_o2="$( echo "${1}" | awk -F'.' '{print $2}' )"
isip_o3="$( echo "${1}" | awk -F'.' '{print $3}' )"
isip_o4="$( echo "${1}" | awk -F'.' '{print $4}' )"
o1="$( echo "${1}" | awk -F'.' '{print $1}' )"
o2="$( echo "${1}" | awk -F'.' '{print $2}' )"
o3="$( echo "${1}" | awk -F'.' '{print $3}' )"
o4="$( echo "${1}" | awk -F'.' '{print $4}' )"
# Cannot start with 0 and all must be below 256
if [ "${isip_o1}" -lt "1" ] || \
[ "${isip_o1}" -gt "255" ] || \
[ "${isip_o2}" -gt "255" ] || \
[ "${isip_o3}" -gt "255" ] || \
[ "${isip_o4}" -gt "255" ]; then
unset -v isip_o1
unset -v isip_o2
unset -v isip_o3
unset -v isip_o4
if [ "${o1}" -lt "1" ] || \
[ "${o1}" -gt "255" ] || \
[ "${o2}" -gt "255" ] || \
[ "${o3}" -gt "255" ] || \
[ "${o4}" -gt "255" ]; then
# Error
return 1
fi
unset -v isip_o1
unset -v isip_o2
unset -v isip_o3
unset -v isip_o4
# Success
return 0
}
# Check whether a string is a valid hostname
_ishostname() {
local hostname="${1}"
local first_char=
local last_char=
# Does not have correct character class
if ! echo "${1}" | grep -Eq '^[-.0-9a-zA-Z]+$'; then
if ! echo "${hostname}" | grep -Eq '^[-.0-9a-zA-Z]+$'; then
return 1
fi
# first and last character
ishostname_f_char="$( echo "${1}" | cut -c1-1 )"
ishostname_l_char="$( echo "${1}" | sed -e 's/.*\(.\)$/\1/' )"
first_char="${hostname:0:1}"
last_char="${hostname: -1}"
# Dot at beginning or end
if [ "${ishostname_f_char}" = "." ] || [ "${ishostname_l_char}" = "." ]; then
unset -v ishostname_f_char
unset -v ishostname_l_char
if [ "${first_char}" = "." ] || [ "${last_char}" = "." ]; then
# Error
return 1
fi
# Dash at beginning or end
if [ "${ishostname_f_char}" = "-" ] || [ "${ishostname_l_char}" = "-" ]; then
unset -v ishostname_f_char
unset -v ishostname_l_char
if [ "${first_char}" = "-" ] || [ "${last_char}" = "-" ]; then
# Error
return 1
fi
unset -v ishostname_f_char
unset -v ishostname_l_char
# Multiple dots next to each other
if echo "${1}" | grep -Eq '[.]{2,}'; then
if echo "${hostname}" | grep -Eq '[.]{2,}'; then
# Error
return 1
fi
# Dash next to dot
if echo "${1}" | grep -Eq '(\.-)|(-\.)'; then
if echo "${hostname}" | grep -Eq '(\.-)|(-\.)'; then
# Error
return 1
fi
@@ -97,32 +80,30 @@ _ishostname() {
}
############################################################
# Functions
############################################################
###
###
### Convert comma separated port-forwards into newline separated "lport:host:rport"
###
port_forward_get_lines() {
local forwards=
local l=
if env_set "${1}"; then
# Transform into newline separated forwards:
# local-port:host:remote-port\n
# local-port:host:remote-port\n
pfl_forwards="$( env_get "${1}" | sed 's/[[:space:]]*//g' | sed 's/,/\n/g' )"
forwards="$( env_get "${1}" | sed 's/[[:space:]]*//g' | sed 's/,/\n/g' )"
# loop over them line by line
IFS='
'
for pfl_line in ${pfl_forwards}; do
echo "${pfl_line}"
for l in ${forwards}; do
echo "${l}"
done
unset -v pfl_forwards
unset -v pfl_line
fi
}
@@ -142,47 +123,53 @@ port_forward_get_rport() {
port_forward_validate() {
pfv_env_varname="${1}"
local env_varname="${1}"
local debug="${2}"
local line=
if ! env_set "${pfv_env_varname}"; then
log "info" "\$${pfv_env_varname} not set."
log "info" "Not ports from other machines will be forwarded to 127.0.0.1 inside this docker"
local lport=
local rhost=
local rport=
if ! env_set "${env_varname}"; then
log "info" "\$${env_varname} not set." "${debug}"
log "info" "Not ports from other machines will be forwarded to 127.0.0.1 inside this docker" "${debug}"
else
# Loop over forwards in order to validate them
for pfv_line in $( port_forward_get_lines "${pfv_env_varname}" ); do
pfv_lport="$( port_forward_get_lport "${pfv_line}" )"
pfv_rhost="$( port_forward_get_rhost "${pfv_line}" )"
pfv_rport="$( port_forward_get_rport "${pfv_line}" )"
for line in $( port_forward_get_lines "${env_varname}" ); do
lport="$( port_forward_get_lport "${line}" )"
rhost="$( port_forward_get_rhost "${line}" )"
rport="$( port_forward_get_rport "${line}" )"
if ! isint "${pfv_lport}"; then
log "err" "Port forwarding error: local port is not an integer: ${pfv_lport}"
log "err" "Line: ${pfv_line}"
# Wrong number of ':' separators
if [ "$( echo "${line}" | grep -o ':' | wc -l )" -ne "2" ]; then
log "err" "Port forwarding error: invalid number of ':' separators" "${debug}"
log "err" "Line: ${line}" "${debug}"
exit
fi
if ! isint "${lport}"; then
log "err" "Port forwarding error: local port is not an integer: ${lport}" "${debug}"
log "err" "Line: ${line}" "${debug}"
exit 1
fi
if ! _isip "${pfv_rhost}" && ! _ishostname "${pfv_rhost}"; then
log "err" "Port forwarding error: remote host is not a valid IP and not a valid hostname: ${pfv_rhost}"
log "err" "Line: ${pfv_line}"
log "err" ""
if ! _isip "${rhost}" && ! _ishostname "${rhost}"; then
log "err" "Port forwarding error: remote host is not a valid IP and not a valid hostname: ${rhost}" "${debug}"
log "err" "Line: ${line}" "${debug}"
log "err" "" "${debug}"
exit 1
fi
if ! isint "${pfv_rport}"; then
log "err" "Port forwarding error: remote port is not an integer: ${pfv_rport}"
log "err" "Line: ${pfv_line}"
log "err" ""
if ! isint "${rport}"; then
log "err" "Port forwarding error: remote port is not an integer: ${rport}" "${debug}"
log "err" "Line: ${line}" "${debug}"
log "err" "" "${debug}"
exit 1
fi
log "info" "Forwarding ${pfv_rhost}:${pfv_rport} to 127.0.0.1:${pfv_lport} inside this docker."
log "info" "Forwarding ${rhost}:${rport} to 127.0.0.1:${lport} inside this docker." "${debug}"
done
unset -v pfv_line
unset -v pfv_lport
unset -v pfv_rhost
unset -v pfv_rport
fi
unset -v pfv_env_varname
}
@@ -190,15 +177,15 @@ port_forward_validate() {
# Sanity Checks
############################################################
if ! command -v awk >/dev/null 2>&1; then
echo "awk not found, but required."
if ! command -v socat >/dev/null 2>&1; then
log "err" "socat not found, but required." "1"
exit 1
fi
if ! command -v cut >/dev/null 2>&1; then
echo "cut not found, but required."
if ! command -v awk >/dev/null 2>&1; then
log "awk not found, but required." "1"
exit 1
fi
if ! command -v sed >/dev/null 2>&1; then
echo "sed not found, but required."
log "sed not found, but required." "1"
exit 1
fi

View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
# Functions
############################################################
###
### Add service to supervisord
###
supervisor_add_service() {
local name="${1}"
local command="${2}"
local confd="${3}"
local debug="${4}"
local priority=
if [ "${#}" -gt "4" ]; then
priority="${5}"
fi
if [ ! -d "${confd}" ]; then
run "mkdir -p ${confd}" "${debug}"
fi
log "info" "Enabling '${name}' to be started by supervisord" "${debug}"
# Add services
{
echo "[program:${name}]";
echo "command = ${command}";
if [ -n "${priority}" ]; then
echo "priority = ${priority}";
fi
echo "autostart = true";
echo "autorestart = true";
echo "stdout_logfile = /dev/stdout";
echo "stdout_logfile_maxbytes = 0";
echo "stdout_events_enabled = true";
echo "stderr_logfile = /dev/stderr";
echo "stderr_logfile_maxbytes = 0";
echo "stderr_events_enabled = true";
} > "${confd}/${name}.conf"
}

View File

@@ -1,13 +1,8 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
############################################################
@@ -18,11 +13,12 @@ set -u
### Copy *.ini files from source to destination with prefix
###
copy_ini_files() {
ini_src="${1}"
ini_dst="${2}"
local ini_src="${1}"
local ini_dst="${2}"
local debug="${3}"
if [ ! -d "${ini_src}" ]; then
run "mkdir -p ${ini_src}"
run "mkdir -p ${ini_src}" "${debug}"
fi
ini_files="$( find "${ini_src}" -type f -iname '*.ini' )"
@@ -31,16 +27,10 @@ copy_ini_files() {
'
for ini_f in ${ini_files}; do
ini_name="$( basename "${ini_f}" )"
log "info" "PHP.ini: ${ini_name} -> ${ini_dst}/zzz-devilbox-${ini_name}"
run "cp ${ini_f} ${ini_dst}/devilbox-${ini_name}"
log "info" "PHP.ini: ${ini_name} -> ${ini_dst}/zzz-devilbox-${ini_name}" "${debug}"
run "cp ${ini_f} ${ini_dst}/zzz-devilbox-${ini_name}" "${debug}"
done
run "find ${ini_dst} -type f -iname '*.ini' -exec chmod 0644 \"{}\" \;"
unset -v ini_src
unset -v ini_dst
unset -v ini_files
unset -v ini_f
unset -v ini_name
run "find ${ini_dst} -type f -iname '*.ini' -exec chmod 0644 \"{}\" \;" "${debug}"
}

View File

@@ -1,60 +0,0 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
# + DEBUG_LEVEL
set -e
set -u
############################################################
# Functions
############################################################
###
### Add service to supervisord
###
supervisor_add_service() {
supervisor_name="${1}"
supervisor_command="${2}"
supervisor_confd="${3}"
supervisor_priority=
if [ "${#}" -gt "3" ]; then
supervisor_priority="${4}"
fi
if [ ! -d "${supervisor_confd}" ]; then
run "mkdir -p ${supervisor_confd}"
fi
# Add services
{
echo "[program:${supervisor_name}]";
echo "command = ${supervisor_command}";
if [ -n "${supervisor_priority}" ]; then
echo "priority = ${supervisor_priority}";
fi
echo "autostart = true";
echo "autorestart = true";
echo "stdout_logfile = /dev/stdout";
echo "stdout_logfile_maxbytes = 0";
echo "stdout_events_enabled = true";
echo "stderr_logfile = /dev/stderr";
echo "stderr_logfile_maxbytes = 0";
echo "stderr_events_enabled = true";
} > "${supervisor_confd}/${supervisor_name}.conf"
unset -v supervisor_name
unset -v supervisor_command
unset -v supervisor_confd
unset -v supervisor_priority
}

View File

@@ -1,73 +1,78 @@
#!/bin/sh
#
# Available global variables:
# + MY_USER
# + MY_GROUP
#!/usr/bin/env bash
set -e
set -u
set -p pipefail
###
### Variables
### Globals
###
PHP_INI_PATH="/usr/local/etc/php.ini"
FPM_ERROR_LOG_CFG="/usr/local/etc/php-fpm.conf"
FPM_ACCESS_LOG_CFG="/usr/local/etc/php-fpm.d/zzz-docker.conf"
# The following global variables are available by our Dockerfile itself:
# MY_USER
# MY_GROUP
# MY_UID
# MY_GID
# Path to scripts to source
CONFIG_DIR="/docker-entrypoint.d"
# php.ini.d directory
PHP_INI_DIR="/usr/local/etc/php/conf.d"
# This file holds error and access log definitions
FPM_CONF_LOGFILE="/usr/local/etc/php-fpm.d/logfiles.conf"
# PHP-FPM log dir
FPM_LOG_DIR="/var/log/php"
#PHP_CUST_MODULE_DIR="/etc/php-modules.d"
# Custom ini dir (to be copied to actual ini dir)
PHP_CUST_INI_DIR="/etc/php-custom.d"
PHP_REAL_INI_DIR="/usr/local/etc/php.d"
# Supervisord config directory
SUPERVISOR_CONFD="/etc/supervisor/conf.d"
###
### Source libs
###
init="$( find /docker-entrypoint.d -name '*.sh' -type f | sort -u )"
init="$( find "${CONFIG_DIR}" -name '*.sh' -type f | sort -u )"
for f in ${init}; do
# shellcheck disable=SC1090
. "${f}"
done
###
### Set Debug level
###
DEBUG_LEVEL="$( get_debug_level "DEBUG_ENTRYPOINT" "0" )"
log "info" "Debug level: ${DEBUG_LEVEL}" "${DEBUG_LEVEL}"
#############################################################
## Sanity checks
#############################################################
if ! command -v socat >/dev/null 2>&1; then
log "err" "socat not found, but required." "${DEBUG_LEVEL}"
exit 1
fi
#############################################################
## Entry Point
#############################################################
###
### Set Debug level
###
DEBUG_LEVEL="$( env_get "DEBUG_ENTRYPOINT" "0" )"
log "info" "Debug level: ${DEBUG_LEVEL}" "${DEBUG_LEVEL}"
###
### Change uid/gid
###
set_uid "NEW_UID"
set_gid "NEW_GID"
set_uid "NEW_UID" "${MY_USER}" "/home/${MY_USER}" "${DEBUG_LEVEL}"
set_gid "NEW_GID" "${MY_GROUP}" "/home/${MY_USER}" "${DEBUG_LEVEL}"
###
### Set timezone
###
set_timezone "TIMEZONE" "${PHP_INI_PATH}"
set_timezone "TIMEZONE" "${PHP_INI_DIR}" "${DEBUG_LEVEL}"
###
### Setup postfix
###
set_postfix "ENABLE_MAIL" "${MY_USER}" "${MY_GROUP}" "${DEBUG_LEVEL}"
###
@@ -76,20 +81,16 @@ set_timezone "TIMEZONE" "${PHP_INI_PATH}"
set_docker_logs \
"DOCKER_LOGS" \
"${FPM_LOG_DIR}" \
"${FPM_ERROR_LOG_CFG}" \
"${FPM_ACCESS_LOG_CFG}"
###
### Setup postfix
###
set_postfix "ENABLE_MAIL"
"${FPM_CONF_LOGFILE}" \
"${MY_USER}" \
"${MY_GROUP}" \
"${DEBUG_LEVEL}"
###
### Validate socat port forwards
###
if ! port_forward_validate "FORWARD_PORTS_TO_LOCALHOST"; then
if ! port_forward_validate "FORWARD_PORTS_TO_LOCALHOST" "${DEBUG_LEVEL}"; then
exit 1
fi
@@ -101,7 +102,11 @@ for line in $( port_forward_get_lines "FORWARD_PORTS_TO_LOCALHOST" ); do
lport="$( port_forward_get_lport "${line}" )"
rhost="$( port_forward_get_rhost "${line}" )"
rport="$( port_forward_get_rport "${line}" )"
supervisor_add_service "socat-${lport}-${rhost}-${rport}" "/usr/bin/socat tcp-listen:${lport},reuseaddr,fork tcp:${rhost}:${rport}" "${SUPERVISOR_CONFD}"
supervisor_add_service \
"socat-${lport}-${rhost}-${rport}" \
"/usr/bin/socat tcp-listen:${lport},reuseaddr,fork tcp:${rhost}:${rport}" \
"${SUPERVISOR_CONFD}" \
"${DEBUG_LEVEL}"
done
@@ -109,24 +114,25 @@ done
### Supervisor: rsyslogd & postfix
###
if [ "$( env_get "ENABLE_MAIL" )" = "1" ]; then
supervisor_add_service "rsyslogd" "/usr/sbin/rsyslogd -n" "${SUPERVISOR_CONFD}" "1"
supervisor_add_service "postfix" "/usr/local/sbin/postfix.sh" "${SUPERVISOR_CONFD}"
supervisor_add_service "rsyslogd" "/usr/sbin/rsyslogd -n" "${SUPERVISOR_CONFD}" "${DEBUG_LEVEL}" "1"
supervisor_add_service "postfix" "/usr/local/sbin/postfix.sh" "${SUPERVISOR_CONFD}" "${DEBUG_LEVEL}"
fi
###
### Supervisor: php-fpm
###
supervisor_add_service "php-fpm" "/usr/local/sbin/php-fpm" "${SUPERVISOR_CONFD}"
supervisor_add_service "php-fpm" "/usr/local/sbin/php-fpm" "${SUPERVISOR_CONFD}" "${DEBUG_LEVEL}"
###
### Copy custom *.ini files
###
copy_ini_files "${PHP_CUST_INI_DIR}" "${PHP_REAL_INI_DIR}"
copy_ini_files "${PHP_CUST_INI_DIR}" "${PHP_INI_DIR}" "${DEBUG_LEVEL}"
###
### Start
### Startup
###
log "info" "Starting supervisord" "${DEBUG_LEVEL}"
exec /usr/bin/supervisord -c /etc/supervisor/supervisord.conf

View File

@@ -46,7 +46,7 @@ RUN set -x \
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/php-fpm.conf /usr/local/etc/php-fpm.conf
COPY ./data/php-fpm.d/devilbox.conf /usr/local/etc/php-fpm.d/zzz-devilbox.conf
COPY ./data/php-fpm.d /usr/local/etc/php-fpm.d
{% if debug %}