mirror of
https://github.com/friendica/docker
synced 2025-01-04 04:38:21 +01:00
commit
34bb363503
19 changed files with 89 additions and 79 deletions
|
@ -95,7 +95,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install apcu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -81,7 +81,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -95,7 +95,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install apcu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -95,7 +95,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install apcu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -81,7 +81,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -95,7 +95,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install apcu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -95,7 +95,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install apcu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -81,7 +81,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install APCu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -95,7 +95,7 @@ RUN set -ex; \
|
|||
# pecl will claim success even if one install fails, so we need to perform each install separately
|
||||
pecl install apcu-5.1.21; \
|
||||
pecl install memcached-3.1.5; \
|
||||
pecl install redis-5.3.6; \
|
||||
pecl install redis-5.3.7; \
|
||||
pecl install imagick-3.7.0; \
|
||||
\
|
||||
docker-php-ext-enable \
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
|
@ -3,8 +3,9 @@ set -eu
|
|||
|
||||
# run an command with the www-data user
|
||||
run_as() {
|
||||
set -- -c "cd /var/www/html; $*"
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
su - www-data -s /bin/sh -c "export PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT}; export PHP_UPLOAD_LIMIT=${PHP_UPLOAD_LIMIT}; $1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
|
@ -20,11 +21,11 @@ version_greater() {
|
|||
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
|
||||
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
local varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
local fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
var="$1"
|
||||
fileVar="${var}_FILE"
|
||||
def="${2:-}"
|
||||
varValue=$(env | grep -E "^${var}=" | sed -E -e "s/^${var}=//")
|
||||
fileVarValue=$(env | grep -E "^${fileVar}=" | sed -E -e "s/^${fileVar}=//")
|
||||
if [ -n "${varValue}" ] && [ -n "${fileVarValue}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
|
@ -49,7 +50,7 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ]; then
|
|||
file_env REDIS_PW
|
||||
echo 'session.save_handler = redis'
|
||||
# check if redis host is an unix socket path
|
||||
if [ "${REDIS_HOST:0:1}" = "/" ]; then
|
||||
if expr "${REDIS_HOST}" : "/" 1>/dev/null; then
|
||||
if [ -n "${REDIS_PW+x}" ]; then
|
||||
echo "session.save_path = \"unix://${REDIS_HOST}?auth=${REDIS_PW}\""
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue