Skip to content

Commit 647c82b

Browse files
committed
Add 8.2
1 parent f0b7532 commit 647c82b

File tree

24 files changed

+1018
-522
lines changed

24 files changed

+1018
-522
lines changed

.github/workflows/ci-cd.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: CI/CD
22

3-
on: [push, workflow_dispatch]
3+
on:
4+
push:
5+
workflow_dispatch:
6+
schedule:
7+
- cron: '0 0 * * 0'
48

59
env:
610
DOCKER_BUILDKIT: 1
@@ -10,7 +14,7 @@ jobs:
1014
runs-on: ubuntu-latest
1115
strategy:
1216
matrix:
13-
version: [ '7.4', '8.0', '8.1' ]
17+
version: [ '7.4', '8.0', '8.1', '8.2' ]
1418
type: [ '', '-prod' ]
1519

1620
steps:

7.4-nginx-prod/entrypoint

+39-40
Original file line numberDiff line numberDiff line change
@@ -16,77 +16,76 @@ user=kool
1616
group=kool
1717
uid=$(id -u)
1818

19-
if [ "$1" = "php-fpm" ] || [ "$1" = "supervisord" ]; then
19+
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then
2020
# Original Wordpress Entrypoint - fresh install if none exists
2121
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then
2222
# 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)
2323
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
24-
chown "$user:$group" .
24+
chown "$user:$group" .
2525
fi
2626

2727
echo >&2 "WordPress not found in $PWD - copying now..."
2828
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then
29-
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
29+
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
3030
fi
3131
sourceTarArgs=(
32-
--create
33-
--file -
34-
--directory /kool/wordpress
35-
--owner "$user" --group "$group"
32+
--create
33+
--file -
34+
--directory /kool/wordpress
35+
--owner "$user" --group "$group"
3636
)
3737
targetTarArgs=(
38-
--extract
39-
--file -
38+
--extract
39+
--file -
4040
)
4141
if [ "$uid" != '0' ]; then
42-
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
43-
targetTarArgs+=( --no-overwrite-dir )
42+
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
43+
targetTarArgs+=( --no-overwrite-dir )
4444
fi
4545
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
4646
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
4747
for contentPath in \
48-
/kool/wordpress/.htaccess \
49-
/kool/wordpress/wp-content/*/*/ \
48+
/kool/wordpress/.htaccess \
49+
/kool/wordpress/wp-content/*/*/ \
5050
; do
5151
contentPath="${contentPath%/}"
5252
[ -e "$contentPath" ] || continue
5353
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc.
5454
if [ -e "$PWD/$contentPath" ]; then
55-
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
56-
sourceTarArgs+=( --exclude "./$contentPath" )
55+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
56+
sourceTarArgs+=( --exclude "./$contentPath" )
5757
fi
5858
done
5959
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
60-
chown -R "$user:$group" /app
6160
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
6261
fi
6362

6463
wpEnvs=( "${!WORDPRESS_@}" )
6564
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then
66-
for wpConfigDocker in \
67-
wp-config-docker.php \
68-
/kool/wordpress/wp-config-docker.php \
69-
; do
70-
if [ -s "$wpConfigDocker" ]; then
71-
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})"
72-
# 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)
73-
awk '
74-
/put your unique phrase here/ {
75-
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1"
76-
cmd | getline str
77-
close(cmd)
78-
gsub("put your unique phrase here", str)
79-
}
80-
{ print }
81-
' "$wpConfigDocker" > wp-config.php
82-
if [ "$uid" = '0' ]; then
83-
# attempt to ensure that wp-config.php is owned by the run user
84-
# could be on a filesystem that doesn't allow chown (like some NFS setups)
85-
chown "$user:$group" wp-config.php || true
86-
fi
87-
break
88-
fi
89-
done
65+
for wpConfigDocker in \
66+
wp-config-docker.php \
67+
/kool/wordpress/wp-config-docker.php \
68+
; do
69+
if [ -s "$wpConfigDocker" ]; then
70+
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})"
71+
# 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)
72+
awk '
73+
/put your unique phrase here/ {
74+
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1"
75+
cmd | getline str
76+
close(cmd)
77+
gsub("put your unique phrase here", str)
78+
}
79+
{ print }
80+
' "$wpConfigDocker" > wp-config.php
81+
if [ "$uid" = '0' ]; then
82+
# attempt to ensure that wp-config.php is owned by the run user
83+
# could be on a filesystem that doesn't allow chown (like some NFS setups)
84+
chown "$user:$group" wp-config.php || true
85+
fi
86+
break
87+
fi
88+
done
9089
fi
9190
fi
9291

7.4-nginx/entrypoint

+39-40
Original file line numberDiff line numberDiff line change
@@ -16,77 +16,76 @@ user=kool
1616
group=kool
1717
uid=$(id -u)
1818

19-
if [ "$1" = "php-fpm" ] || [ "$1" = "supervisord" ]; then
19+
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then
2020
# Original Wordpress Entrypoint - fresh install if none exists
2121
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then
2222
# 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)
2323
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
24-
chown "$user:$group" .
24+
chown "$user:$group" .
2525
fi
2626

2727
echo >&2 "WordPress not found in $PWD - copying now..."
2828
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then
29-
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
29+
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
3030
fi
3131
sourceTarArgs=(
32-
--create
33-
--file -
34-
--directory /kool/wordpress
35-
--owner "$user" --group "$group"
32+
--create
33+
--file -
34+
--directory /kool/wordpress
35+
--owner "$user" --group "$group"
3636
)
3737
targetTarArgs=(
38-
--extract
39-
--file -
38+
--extract
39+
--file -
4040
)
4141
if [ "$uid" != '0' ]; then
42-
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
43-
targetTarArgs+=( --no-overwrite-dir )
42+
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
43+
targetTarArgs+=( --no-overwrite-dir )
4444
fi
4545
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
4646
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
4747
for contentPath in \
48-
/kool/wordpress/.htaccess \
49-
/kool/wordpress/wp-content/*/*/ \
48+
/kool/wordpress/.htaccess \
49+
/kool/wordpress/wp-content/*/*/ \
5050
; do
5151
contentPath="${contentPath%/}"
5252
[ -e "$contentPath" ] || continue
5353
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc.
5454
if [ -e "$PWD/$contentPath" ]; then
55-
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
56-
sourceTarArgs+=( --exclude "./$contentPath" )
55+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
56+
sourceTarArgs+=( --exclude "./$contentPath" )
5757
fi
5858
done
5959
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
60-
chown -R "$user:$group" /app
6160
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
6261
fi
6362

6463
wpEnvs=( "${!WORDPRESS_@}" )
6564
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then
66-
for wpConfigDocker in \
67-
wp-config-docker.php \
68-
/kool/wordpress/wp-config-docker.php \
69-
; do
70-
if [ -s "$wpConfigDocker" ]; then
71-
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})"
72-
# 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)
73-
awk '
74-
/put your unique phrase here/ {
75-
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1"
76-
cmd | getline str
77-
close(cmd)
78-
gsub("put your unique phrase here", str)
79-
}
80-
{ print }
81-
' "$wpConfigDocker" > wp-config.php
82-
if [ "$uid" = '0' ]; then
83-
# attempt to ensure that wp-config.php is owned by the run user
84-
# could be on a filesystem that doesn't allow chown (like some NFS setups)
85-
chown "$user:$group" wp-config.php || true
86-
fi
87-
break
88-
fi
89-
done
65+
for wpConfigDocker in \
66+
wp-config-docker.php \
67+
/kool/wordpress/wp-config-docker.php \
68+
; do
69+
if [ -s "$wpConfigDocker" ]; then
70+
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})"
71+
# 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)
72+
awk '
73+
/put your unique phrase here/ {
74+
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1"
75+
cmd | getline str
76+
close(cmd)
77+
gsub("put your unique phrase here", str)
78+
}
79+
{ print }
80+
' "$wpConfigDocker" > wp-config.php
81+
if [ "$uid" = '0' ]; then
82+
# attempt to ensure that wp-config.php is owned by the run user
83+
# could be on a filesystem that doesn't allow chown (like some NFS setups)
84+
chown "$user:$group" wp-config.php || true
85+
fi
86+
break
87+
fi
88+
done
9089
fi
9190
fi
9291

7.4-prod/entrypoint

+39-40
Original file line numberDiff line numberDiff line change
@@ -14,77 +14,76 @@ user=kool
1414
group=kool
1515
uid=$(id -u)
1616

17-
if [ "$1" = "php-fpm" ] || [ "$1" = "supervisord" ]; then
17+
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then
1818
# Original Wordpress Entrypoint - fresh install if none exists
1919
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then
2020
# 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)
2121
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
22-
chown "$user:$group" .
22+
chown "$user:$group" .
2323
fi
2424

2525
echo >&2 "WordPress not found in $PWD - copying now..."
2626
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then
27-
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
27+
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
2828
fi
2929
sourceTarArgs=(
30-
--create
31-
--file -
32-
--directory /kool/wordpress
33-
--owner "$user" --group "$group"
30+
--create
31+
--file -
32+
--directory /kool/wordpress
33+
--owner "$user" --group "$group"
3434
)
3535
targetTarArgs=(
36-
--extract
37-
--file -
36+
--extract
37+
--file -
3838
)
3939
if [ "$uid" != '0' ]; then
40-
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
41-
targetTarArgs+=( --no-overwrite-dir )
40+
# avoid "tar: .: Cannot utime: Operation not permitted" and "tar: .: Cannot change mode to rwxr-xr-x: Operation not permitted"
41+
targetTarArgs+=( --no-overwrite-dir )
4242
fi
4343
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
4444
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
4545
for contentPath in \
46-
/kool/wordpress/.htaccess \
47-
/kool/wordpress/wp-content/*/*/ \
46+
/kool/wordpress/.htaccess \
47+
/kool/wordpress/wp-content/*/*/ \
4848
; do
4949
contentPath="${contentPath%/}"
5050
[ -e "$contentPath" ] || continue
5151
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc.
5252
if [ -e "$PWD/$contentPath" ]; then
53-
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
54-
sourceTarArgs+=( --exclude "./$contentPath" )
53+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
54+
sourceTarArgs+=( --exclude "./$contentPath" )
5555
fi
5656
done
5757
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
58-
chown -R "$user:$group" /app
5958
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
6059
fi
6160

6261
wpEnvs=( "${!WORDPRESS_@}" )
6362
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then
64-
for wpConfigDocker in \
65-
wp-config-docker.php \
66-
/kool/wordpress/wp-config-docker.php \
67-
; do
68-
if [ -s "$wpConfigDocker" ]; then
69-
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})"
70-
# 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)
71-
awk '
72-
/put your unique phrase here/ {
73-
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1"
74-
cmd | getline str
75-
close(cmd)
76-
gsub("put your unique phrase here", str)
77-
}
78-
{ print }
79-
' "$wpConfigDocker" > wp-config.php
80-
if [ "$uid" = '0' ]; then
81-
# attempt to ensure that wp-config.php is owned by the run user
82-
# could be on a filesystem that doesn't allow chown (like some NFS setups)
83-
chown "$user:$group" wp-config.php || true
84-
fi
85-
break
86-
fi
87-
done
63+
for wpConfigDocker in \
64+
wp-config-docker.php \
65+
/kool/wordpress/wp-config-docker.php \
66+
; do
67+
if [ -s "$wpConfigDocker" ]; then
68+
echo >&2 "No 'wp-config.php' found in $PWD, but 'WORDPRESS_...' variables supplied; copying '$wpConfigDocker' (${wpEnvs[*]})"
69+
# 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)
70+
awk '
71+
/put your unique phrase here/ {
72+
cmd = "head -c1m /dev/urandom | sha1sum | cut -d\\ -f1"
73+
cmd | getline str
74+
close(cmd)
75+
gsub("put your unique phrase here", str)
76+
}
77+
{ print }
78+
' "$wpConfigDocker" > wp-config.php
79+
if [ "$uid" = '0' ]; then
80+
# attempt to ensure that wp-config.php is owned by the run user
81+
# could be on a filesystem that doesn't allow chown (like some NFS setups)
82+
chown "$user:$group" wp-config.php || true
83+
fi
84+
break
85+
fi
86+
done
8887
fi
8988
fi
9089

0 commit comments

Comments
 (0)