Skip to content

Commit

Permalink
Merge pull request #249 from akolnoochenko/master
Browse files Browse the repository at this point in the history
Change hardcoded www-data:www-data
  • Loading branch information
yosifkit authored Dec 21, 2017
2 parents 1e1456c + 43d3269 commit 1b48b4b
Show file tree
Hide file tree
Showing 13 changed files with 312 additions and 39 deletions.
27 changes: 24 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ file_env() {
}

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi

if ! [ -e index.php -a -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
tar --create \
--file - \
--one-file-system \
--directory /usr/src/wordpress \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
Expand All @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
chown "$user:$group" .htaccess
fi
fi

Expand Down Expand Up @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
}
EOPHP
chown www-data:www-data wp-config.php
chown "$user:$group" wp-config.php
fi

# see http://stackoverflow.com/a/2705678/433558
Expand Down
27 changes: 24 additions & 3 deletions php5.6/apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ file_env() {
}

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi

if ! [ -e index.php -a -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
tar --create \
--file - \
--one-file-system \
--directory /usr/src/wordpress \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
Expand All @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
chown "$user:$group" .htaccess
fi
fi

Expand Down Expand Up @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
}
EOPHP
chown www-data:www-data wp-config.php
chown "$user:$group" wp-config.php
fi

# see http://stackoverflow.com/a/2705678/433558
Expand Down
27 changes: 24 additions & 3 deletions php5.6/fpm-alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ file_env() {
}

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi

if ! [ -e index.php -a -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
tar --create \
--file - \
--one-file-system \
--directory /usr/src/wordpress \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
Expand All @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
chown "$user:$group" .htaccess
fi
fi

Expand Down Expand Up @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
}
EOPHP
chown www-data:www-data wp-config.php
chown "$user:$group" wp-config.php
fi

# see http://stackoverflow.com/a/2705678/433558
Expand Down
27 changes: 24 additions & 3 deletions php5.6/fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ file_env() {
}

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi

if ! [ -e index.php -a -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
tar --create \
--file - \
--one-file-system \
--directory /usr/src/wordpress \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
Expand All @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
chown "$user:$group" .htaccess
fi
fi

Expand Down Expand Up @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
}
EOPHP
chown www-data:www-data wp-config.php
chown "$user:$group" wp-config.php
fi

# see http://stackoverflow.com/a/2705678/433558
Expand Down
27 changes: 24 additions & 3 deletions php7.0/apache/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ file_env() {
}

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi

if ! [ -e index.php -a -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
tar --create \
--file - \
--one-file-system \
--directory /usr/src/wordpress \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
Expand All @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
chown "$user:$group" .htaccess
fi
fi

Expand Down Expand Up @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
}
EOPHP
chown www-data:www-data wp-config.php
chown "$user:$group" wp-config.php
fi

# see http://stackoverflow.com/a/2705678/433558
Expand Down
27 changes: 24 additions & 3 deletions php7.0/fpm-alpine/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ file_env() {
}

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi

if ! [ -e index.php -a -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
tar --create \
--file - \
--one-file-system \
--directory /usr/src/wordpress \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
Expand All @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
chown "$user:$group" .htaccess
fi
fi

Expand Down Expand Up @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
}
EOPHP
chown www-data:www-data wp-config.php
chown "$user:$group" wp-config.php
fi

# see http://stackoverflow.com/a/2705678/433558
Expand Down
27 changes: 24 additions & 3 deletions php7.0/fpm/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ file_env() {
}

if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
if [ "$(id -u)" = '0' ]; then
case "$1" in
apache2*)
user="${APACHE_RUN_USER:-www-data}"
group="${APACHE_RUN_GROUP:-www-data}"
;;
*) # php-fpm
user='www-data'
group='www-data'
;;
esac
else
user="$(id -u)"
group="$(id -g)"
fi

if ! [ -e index.php -a -e wp-includes/version.php ]; then
echo >&2 "WordPress not found in $PWD - copying now..."
if [ "$(ls -A)" ]; then
echo >&2 "WARNING: $PWD is not empty - press Ctrl+C now if this is an error!"
( set -x; ls -A; sleep 10 )
fi
tar cf - --one-file-system -C /usr/src/wordpress . | tar xf -
tar --create \
--file - \
--one-file-system \
--directory /usr/src/wordpress \
--owner "$user" --group "$group" \
. | tar --extract --file -
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
if [ ! -e .htaccess ]; then
# NOTE: The "Indexes" option is disabled in the php:apache base image
Expand All @@ -46,7 +67,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then
</IfModule>
# END WordPress
EOF
chown www-data:www-data .htaccess
chown "$user:$group" .htaccess
fi
fi

Expand Down Expand Up @@ -115,7 +136,7 @@ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROT
}
EOPHP
chown www-data:www-data wp-config.php
chown "$user:$group" wp-config.php
fi

# see http://stackoverflow.com/a/2705678/433558
Expand Down
Loading

0 comments on commit 1b48b4b

Please sign in to comment.