Skip to content

Commit 7566d35

Browse files
committed
Adding 8.3
1 parent df89e46 commit 7566d35

File tree

7 files changed

+265
-3
lines changed

7 files changed

+265
-3
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
version: [ '7.4', '8.0', '8.1', '8.2' ]
15+
version: [ '7.4', '8.0', '8.1', '8.2', '8.3' ]
1616
type: [ '', '-prod' ]
1717

1818
steps:

8.3-nginx-prod/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM wordpress:cli-php8.3 as wordpress-cli
2+
FROM wordpress:php8.3-fpm-alpine as wordpress
3+
FROM kooldev/php:8.3-nginx-prod
4+
5+
ENV NGINX_ROOT=/app
6+
7+
COPY --from=wordpress-cli /usr/local/bin/wp /usr/local/bin/wp
8+
COPY --from=wordpress --chown=kool:kool /usr/src/wordpress /kool/wordpress
9+
COPY --from=wordpress --chown=kool:kool /var/www/html/wp-content /app/wp-content
10+
COPY entrypoint /kool/wordpress-entrypoint
11+
12+
RUN chmod -R 777 wp-content && chmod +x /kool/wordpress-entrypoint
13+
14+
ENTRYPOINT [ "/kool/wordpress-entrypoint" ]
15+
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ]

8.3-nginx-prod/entrypoint

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
# Nginx server config
5+
dockerize -template /kool/default.tmpl:/etc/nginx/conf.d/default.conf
6+
7+
# Run as current user
8+
CURRENT_USER=${ASUSER:-${UID:-0}}
9+
10+
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then
11+
usermod -u $CURRENT_USER kool
12+
fi
13+
14+
# user/group for Wordpress
15+
user=kool
16+
group=kool
17+
uid=$(id -u)
18+
19+
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then
20+
# Original Wordpress Entrypoint - fresh install if none exists
21+
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then
22+
# 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)
23+
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
24+
chown "$user:$group" .
25+
fi
26+
27+
echo >&2 "WordPress not found in $PWD - copying now..."
28+
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then
29+
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
30+
fi
31+
sourceTarArgs=(
32+
--create
33+
--file -
34+
--directory /kool/wordpress
35+
--owner "$user" --group "$group"
36+
)
37+
targetTarArgs=(
38+
--extract
39+
--file -
40+
)
41+
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 )
44+
fi
45+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
46+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
47+
for contentPath in \
48+
/kool/wordpress/.htaccess \
49+
/kool/wordpress/wp-content/*/*/ \
50+
; do
51+
contentPath="${contentPath%/}"
52+
[ -e "$contentPath" ] || continue
53+
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc.
54+
if [ -e "$PWD/$contentPath" ]; then
55+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
56+
sourceTarArgs+=( --exclude "./$contentPath" )
57+
fi
58+
done
59+
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
60+
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
61+
fi
62+
63+
wpEnvs=( "${!WORDPRESS_@}" )
64+
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then
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
89+
fi
90+
fi
91+
92+
exec /kool/entrypoint "$@"

8.3-nginx/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM wordpress:cli-php8.3 as wordpress-cli
2+
FROM wordpress:php8.3-fpm-alpine as wordpress
3+
FROM kooldev/php:8.3-nginx
4+
5+
ENV NGINX_ROOT=/app
6+
7+
COPY --from=wordpress-cli /usr/local/bin/wp /usr/local/bin/wp
8+
COPY --from=wordpress --chown=kool:kool /usr/src/wordpress /kool/wordpress
9+
COPY --from=wordpress --chown=kool:kool /var/www/html/wp-content /app/wp-content
10+
COPY entrypoint /kool/wordpress-entrypoint
11+
12+
RUN chmod -R 777 wp-content && chmod +x /kool/wordpress-entrypoint
13+
14+
ENTRYPOINT [ "/kool/wordpress-entrypoint" ]
15+
CMD [ "supervisord", "-c", "/kool/supervisor.conf" ]

8.3-nginx/entrypoint

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
4+
# Nginx server config
5+
dockerize -template /kool/default.tmpl:/etc/nginx/conf.d/default.conf
6+
7+
# Run as current user
8+
CURRENT_USER=${ASUSER:-${UID:-0}}
9+
10+
if [ ! -z "$CURRENT_USER" ] && [ "$CURRENT_USER" != "0" ]; then
11+
usermod -u $CURRENT_USER kool
12+
fi
13+
14+
# user/group for Wordpress
15+
user=kool
16+
group=kool
17+
uid=$(id -u)
18+
19+
if [ "$1" = 'php-fpm' ] || [ "$1" = 'supervisord' ]; then
20+
# Original Wordpress Entrypoint - fresh install if none exists
21+
if [ ! -e index.php ] && [ ! -e wp-includes/version.php ]; then
22+
# 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)
23+
if [ "$uid" = '0' ] && [ "$(stat -c '%u:%g' .)" = '0:0' ]; then
24+
chown "$user:$group" .
25+
fi
26+
27+
echo >&2 "WordPress not found in $PWD - copying now..."
28+
if [ -n "$(find -mindepth 1 -maxdepth 1 -not -name wp-content)" ]; then
29+
echo >&2 "WARNING: $PWD is not empty! (copying anyhow)"
30+
fi
31+
sourceTarArgs=(
32+
--create
33+
--file -
34+
--directory /kool/wordpress
35+
--owner "$user" --group "$group"
36+
)
37+
targetTarArgs=(
38+
--extract
39+
--file -
40+
)
41+
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 )
44+
fi
45+
# loop over "pluggable" content in the source, and if it already exists in the destination, skip it
46+
# https://github.com/docker-library/wordpress/issues/506 ("wp-content" persisted, "akismet" updated, WordPress container restarted/recreated, "akismet" downgraded)
47+
for contentPath in \
48+
/kool/wordpress/.htaccess \
49+
/kool/wordpress/wp-content/*/*/ \
50+
; do
51+
contentPath="${contentPath%/}"
52+
[ -e "$contentPath" ] || continue
53+
contentPath="${contentPath#/kool/wordpress/}" # "wp-content/plugins/akismet", etc.
54+
if [ -e "$PWD/$contentPath" ]; then
55+
echo >&2 "WARNING: '$PWD/$contentPath' exists! (not copying the WordPress version)"
56+
sourceTarArgs+=( --exclude "./$contentPath" )
57+
fi
58+
done
59+
tar "${sourceTarArgs[@]}" . | tar "${targetTarArgs[@]}"
60+
echo >&2 "Complete! WordPress has been successfully copied to $PWD"
61+
fi
62+
63+
wpEnvs=( "${!WORDPRESS_@}" )
64+
if [ ! -s wp-config.php ] && [ "${#wpEnvs[@]}" -gt 0 ]; then
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
89+
fi
90+
fi
91+
92+
exec /kool/entrypoint "$@"

fwd-template.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,44 @@
304304
"path": "template/entrypoint"
305305
}
306306
]
307+
},
308+
{
309+
"name": "8.3-nginx",
310+
"data": {
311+
"from": "kooldev/php:8.3-nginx",
312+
"nginx": true,
313+
"prod": false,
314+
"version": "8.3"
315+
},
316+
"files": [
317+
{
318+
"name": "Dockerfile",
319+
"path": "template/Dockerfile"
320+
},
321+
{
322+
"name": "entrypoint",
323+
"path": "template/entrypoint"
324+
}
325+
]
326+
},
327+
{
328+
"name": "8.3-nginx-prod",
329+
"data": {
330+
"from": "kooldev/php:8.3-nginx-prod",
331+
"nginx": true,
332+
"prod": true,
333+
"version": "8.3"
334+
},
335+
"files": [
336+
{
337+
"name": "Dockerfile",
338+
"path": "template/Dockerfile"
339+
},
340+
{
341+
"name": "entrypoint",
342+
"path": "template/entrypoint"
343+
}
344+
]
307345
}
308346
]
309347
}

kool.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ scripts:
1313
- docker build -t kooldev/wordpress:8.0-prod 8.0-prod
1414
- docker build -t kooldev/wordpress:8.0-nginx 8.0-nginx
1515
- docker build -t kooldev/wordpress:8.0-nginx-prod 8.0-nginx-prod
16-
# PHP 8.1
17-
- docker build --pull -t kooldev/wordpress:8.1 8.1
16+
# PHP 8.2
17+
- docker build --pull -t kooldev/wordpress:8.2 8.2
1818
- docker build -t kooldev/wordpress:8.1-prod 8.1-prod
1919
- docker build -t kooldev/wordpress:8.1-nginx 8.1-nginx
2020
- docker build -t kooldev/wordpress:8.1-nginx-prod 8.1-nginx-prod
21+
# PHP 8.2
22+
- docker build --pull -t kooldev/wordpress:8.2 8.2
23+
- docker build -t kooldev/wordpress:8.2-prod 8.2-prod
24+
- docker build -t kooldev/wordpress:8.2-nginx 8.2-nginx
25+
- docker build -t kooldev/wordpress:8.2-nginx-prod 8.2-nginx-prod
26+
# PHP 8.3
27+
- docker build --pull -t kooldev/wordpress:8.3 8.3
28+
- docker build -t kooldev/wordpress:8.3-prod 8.3-prod
29+
- docker build -t kooldev/wordpress:8.3-nginx 8.3-nginx
30+
- docker build -t kooldev/wordpress:8.3-nginx-prod 8.3-nginx-prod

0 commit comments

Comments
 (0)