-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from kool-dev/8.3
Adding 8.3
- Loading branch information
Showing
12 changed files
with
516 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM wordpress:cli-php8.3 as wordpress-cli | ||
FROM wordpress:php8.3-fpm-alpine as wordpress | ||
FROM kooldev/php:8.3-nginx-prod | ||
|
||
ENV NGINX_ROOT=/app | ||
|
||
COPY --from=wordpress-cli /usr/local/bin/wp /usr/local/bin/wp | ||
COPY --from=wordpress --chown=kool:kool /usr/src/wordpress /kool/wordpress | ||
COPY --from=wordpress --chown=kool:kool /var/www/html/wp-content /app/wp-content | ||
COPY entrypoint /kool/wordpress-entrypoint | ||
|
||
RUN chmod -R 777 wp-content && chmod +x /kool/wordpress-entrypoint | ||
|
||
ENTRYPOINT [ "/kool/wordpress-entrypoint" ] | ||
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
# Nginx server config | ||
dockerize -template /kool/default.tmpl:/etc/nginx/conf.d/default.conf | ||
|
||
# Run as current user | ||
CURRENT_USER=${ASUSER:-${UID:-0}} | ||
|
||
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then | ||
usermod -u $CURRENT_USER kool | ||
fi | ||
|
||
# user/group for Wordpress | ||
user=kool | ||
group=kool | ||
uid=$(id -u) | ||
|
||
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then | ||
# Original Wordpress Entrypoint - fresh install if none exists | ||
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then | ||
# if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) | ||
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then | ||
chown "$user:$group" . | ||
fi | ||
|
||
echo >&2 "WordPress not found in $PWD - copying now..." | ||
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then | ||
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" | ||
fi | ||
sourceTarArgs=( | ||
--create | ||
--file - | ||
--directory /kool/wordpress | ||
--owner "$user" --group "$group" | ||
) | ||
targetTarArgs=( | ||
--extract | ||
--file - | ||
) | ||
if [ "$uid" != '0' ]; then | ||
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" | ||
targetTarArgs+=( --no-overwrite-dir ) | ||
fi | ||
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it | ||
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) | ||
for contentPath in \ | ||
/kool/wordpress/.htaccess \ | ||
/kool/wordpress/wp-content/*/*/ \ | ||
; do | ||
contentPath="${contentPath%/}" | ||
[ -e "$contentPath" ] || continue | ||
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc. | ||
if [ -e "$PWD/$contentPath" ]; then | ||
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" | ||
sourceTarArgs+=( --exclude "./$contentPath" ) | ||
fi | ||
done | ||
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" | ||
echo >&2 "Complete! WordPress has been successfully copied to $PWD" | ||
fi | ||
|
||
wpEnvs=( "${!WORDPRESS_@}" ) | ||
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then | ||
for wpConfigDocker in \ | ||
wp-config-docker.php \ | ||
/kool/wordpress/wp-config-docker.php \ | ||
; do | ||
if [ -s "$wpConfigDocker" ]; then | ||
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" | ||
# using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) | ||
awk ' | ||
/put your unique phrase here/ { | ||
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" | ||
cmd | getline str | ||
close(cmd) | ||
gsub("put your unique phrase here", str) | ||
} | ||
{ print } | ||
' "$wpConfigDocker" > wp-config.php | ||
if [ "$uid" = '0' ]; then | ||
# attempt to ensure that wp-config.php is owned by the run user | ||
# could be on a filesystem that doesn't allow chown (like some NFS setups) | ||
chown "$user:$group" wp-config.php || true | ||
fi | ||
break | ||
fi | ||
done | ||
fi | ||
fi | ||
|
||
exec /kool/entrypoint "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM wordpress:cli-php8.3 as wordpress-cli | ||
FROM wordpress:php8.3-fpm-alpine as wordpress | ||
FROM kooldev/php:8.3-nginx | ||
|
||
ENV NGINX_ROOT=/app | ||
|
||
COPY --from=wordpress-cli /usr/local/bin/wp /usr/local/bin/wp | ||
COPY --from=wordpress --chown=kool:kool /usr/src/wordpress /kool/wordpress | ||
COPY --from=wordpress --chown=kool:kool /var/www/html/wp-content /app/wp-content | ||
COPY entrypoint /kool/wordpress-entrypoint | ||
|
||
RUN chmod -R 777 wp-content && chmod +x /kool/wordpress-entrypoint | ||
|
||
ENTRYPOINT [ "/kool/wordpress-entrypoint" ] | ||
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
# Nginx server config | ||
dockerize -template /kool/default.tmpl:/etc/nginx/conf.d/default.conf | ||
|
||
# Run as current user | ||
CURRENT_USER=${ASUSER:-${UID:-0}} | ||
|
||
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then | ||
usermod -u $CURRENT_USER kool | ||
fi | ||
|
||
# user/group for Wordpress | ||
user=kool | ||
group=kool | ||
uid=$(id -u) | ||
|
||
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then | ||
# Original Wordpress Entrypoint - fresh install if none exists | ||
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then | ||
# if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) | ||
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then | ||
chown "$user:$group" . | ||
fi | ||
|
||
echo >&2 "WordPress not found in $PWD - copying now..." | ||
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then | ||
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" | ||
fi | ||
sourceTarArgs=( | ||
--create | ||
--file - | ||
--directory /kool/wordpress | ||
--owner "$user" --group "$group" | ||
) | ||
targetTarArgs=( | ||
--extract | ||
--file - | ||
) | ||
if [ "$uid" != '0' ]; then | ||
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" | ||
targetTarArgs+=( --no-overwrite-dir ) | ||
fi | ||
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it | ||
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) | ||
for contentPath in \ | ||
/kool/wordpress/.htaccess \ | ||
/kool/wordpress/wp-content/*/*/ \ | ||
; do | ||
contentPath="${contentPath%/}" | ||
[ -e "$contentPath" ] || continue | ||
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc. | ||
if [ -e "$PWD/$contentPath" ]; then | ||
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" | ||
sourceTarArgs+=( --exclude "./$contentPath" ) | ||
fi | ||
done | ||
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" | ||
echo >&2 "Complete! WordPress has been successfully copied to $PWD" | ||
fi | ||
|
||
wpEnvs=( "${!WORDPRESS_@}" ) | ||
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then | ||
for wpConfigDocker in \ | ||
wp-config-docker.php \ | ||
/kool/wordpress/wp-config-docker.php \ | ||
; do | ||
if [ -s "$wpConfigDocker" ]; then | ||
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" | ||
# using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) | ||
awk ' | ||
/put your unique phrase here/ { | ||
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" | ||
cmd | getline str | ||
close(cmd) | ||
gsub("put your unique phrase here", str) | ||
} | ||
{ print } | ||
' "$wpConfigDocker" > wp-config.php | ||
if [ "$uid" = '0' ]; then | ||
# attempt to ensure that wp-config.php is owned by the run user | ||
# could be on a filesystem that doesn't allow chown (like some NFS setups) | ||
chown "$user:$group" wp-config.php || true | ||
fi | ||
break | ||
fi | ||
done | ||
fi | ||
fi | ||
|
||
exec /kool/entrypoint "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM wordpress:cli-php8.3 as wordpress-cli | ||
FROM wordpress:php8.3-fpm-alpine as wordpress | ||
FROM kooldev/php:8.3-prod | ||
|
||
|
||
COPY --from=wordpress-cli /usr/local/bin/wp /usr/local/bin/wp | ||
COPY --from=wordpress --chown=kool:kool /usr/src/wordpress /kool/wordpress | ||
COPY --from=wordpress --chown=kool:kool /var/www/html/wp-content /app/wp-content | ||
COPY entrypoint /kool/wordpress-entrypoint | ||
|
||
RUN chmod -R 777 wp-content && chmod +x /kool/wordpress-entrypoint | ||
|
||
ENTRYPOINT [ "/kool/wordpress-entrypoint" ] | ||
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
|
||
# Run as current user | ||
CURRENT_USER=${ASUSER:-${UID:-0}} | ||
|
||
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then | ||
usermod -u $CURRENT_USER kool | ||
fi | ||
|
||
# user/group for Wordpress | ||
user=kool | ||
group=kool | ||
uid=$(id -u) | ||
|
||
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then | ||
# Original Wordpress Entrypoint - fresh install if none exists | ||
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then | ||
# if the directory exists and WordPress doesn't appear to be installed AND the permissions of it are root:root, let's chown it (likely a Docker-created directory) | ||
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then | ||
chown "$user:$group" . | ||
fi | ||
|
||
echo >&2 "WordPress not found in $PWD - copying now..." | ||
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then | ||
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)" | ||
fi | ||
sourceTarArgs=( | ||
--create | ||
--file - | ||
--directory /kool/wordpress | ||
--owner "$user" --group "$group" | ||
) | ||
targetTarArgs=( | ||
--extract | ||
--file - | ||
) | ||
if [ "$uid" != '0' ]; then | ||
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted" | ||
targetTarArgs+=( --no-overwrite-dir ) | ||
fi | ||
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it | ||
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded) | ||
for contentPath in \ | ||
/kool/wordpress/.htaccess \ | ||
/kool/wordpress/wp-content/*/*/ \ | ||
; do | ||
contentPath="${contentPath%/}" | ||
[ -e "$contentPath" ] || continue | ||
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc. | ||
if [ -e "$PWD/$contentPath" ]; then | ||
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)" | ||
sourceTarArgs+=( --exclude "./$contentPath" ) | ||
fi | ||
done | ||
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}" | ||
echo >&2 "Complete! WordPress has been successfully copied to $PWD" | ||
fi | ||
|
||
wpEnvs=( "${!WORDPRESS_@}" ) | ||
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then | ||
for wpConfigDocker in \ | ||
wp-config-docker.php \ | ||
/kool/wordpress/wp-config-docker.php \ | ||
; do | ||
if [ -s "$wpConfigDocker" ]; then | ||
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})" | ||
# using "awk" to replace all instances of "put your unique phrase here" with a properly unique string (for AUTH_KEY and friends to have safe defaults if they aren't specified with environment variables) | ||
awk ' | ||
/put your unique phrase here/ { | ||
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1" | ||
cmd | getline str | ||
close(cmd) | ||
gsub("put your unique phrase here", str) | ||
} | ||
{ print } | ||
' "$wpConfigDocker" > wp-config.php | ||
if [ "$uid" = '0' ]; then | ||
# attempt to ensure that wp-config.php is owned by the run user | ||
# could be on a filesystem that doesn't allow chown (like some NFS setups) | ||
chown "$user:$group" wp-config.php || true | ||
fi | ||
break | ||
fi | ||
done | ||
fi | ||
fi | ||
|
||
exec /kool/entrypoint "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM wordpress:cli-php8.3 as wordpress-cli | ||
FROM wordpress:php8.3-fpm-alpine as wordpress | ||
FROM kooldev/php:8.3 | ||
|
||
|
||
COPY --from=wordpress-cli /usr/local/bin/wp /usr/local/bin/wp | ||
COPY --from=wordpress --chown=kool:kool /usr/src/wordpress /kool/wordpress | ||
COPY --from=wordpress --chown=kool:kool /var/www/html/wp-content /app/wp-content | ||
COPY entrypoint /kool/wordpress-entrypoint | ||
|
||
RUN chmod -R 777 wp-content && chmod +x /kool/wordpress-entrypoint | ||
|
||
ENTRYPOINT [ "/kool/wordpress-entrypoint" ] | ||
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ] |
Oops, something went wrong.