Skip to content

Commit df89e46

Browse files
authored
Merge pull request #12 from kool-dev/8.2
Add 8.2
2 parents f0b7532 + 1fc2d37 commit df89e46

File tree

24 files changed

+1054
-532
lines changed

24 files changed

+1054
-532
lines changed

.github/workflows/ci-cd.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CI/CD
22

3-
on: [push, workflow_dispatch]
3+
on:
4+
push:
5+
workflow_dispatch:
46

57
env:
68
DOCKER_BUILDKIT: 1
@@ -10,22 +12,32 @@ jobs:
1012
runs-on: ubuntu-latest
1113
strategy:
1214
matrix:
13-
version: [ '7.4', '8.0', '8.1' ]
15+
version: [ '7.4', '8.0', '8.1', '8.2' ]
1416
type: [ '', '-prod' ]
1517

1618
steps:
1719
- name: Checkout code
18-
uses: actions/checkout@master
20+
uses: actions/checkout@v3
1921

20-
- name: Build image
21-
run: |
22-
docker build \
23-
--tag kooldev/wordpress:${{ matrix.version }}${{ matrix.type }} \
24-
${{ matrix.version }}${{ matrix.type }}
22+
- name: Setup QEMU
23+
uses: docker/setup-qemu-action@v2
24+
25+
- name: Setup Docker Buildx
26+
uses: docker/setup-buildx-action@v2
27+
28+
- name: Build and export to Docker
29+
uses: docker/build-push-action@v3
30+
with:
31+
context: ${{ matrix.version }}${{ matrix.type }}
32+
load: true
33+
tags: kooldev/wordpress:${{ matrix.version }}${{ matrix.type }}
2534

26-
docker build \
27-
--tag kooldev/wordpress:${{ matrix.version }}-nginx${{ matrix.type }} \
28-
${{ matrix.version }}-nginx${{ matrix.type }}
35+
- name: Build and export to Docker (nginx)
36+
uses: docker/build-push-action@v3
37+
with:
38+
context: ${{ matrix.version }}-nginx${{ matrix.type }}
39+
load: true
40+
tags: kooldev/wordpress:${{ matrix.version }}-nginx${{ matrix.type }}
2941

3042
- name: Test docker images PHP executable
3143
run: |
@@ -44,7 +56,7 @@ jobs:
4456
docker run kooldev/wordpress:${{ matrix.version }}-nginx${{ matrix.type }} php /kool/wordpress/index.php
4557
4658
- name: Login to DockerHub
47-
uses: docker/login-action@v1
59+
uses: docker/login-action@v2
4860
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-wordpress'
4961
with:
5062
username: ${{ secrets.DOCKER_USERNAME }}
@@ -55,3 +67,21 @@ jobs:
5567
run: |
5668
docker push kooldev/wordpress:${{ matrix.version }}${{ matrix.type }}
5769
docker push kooldev/wordpress:${{ matrix.version }}-nginx${{ matrix.type }}
70+
71+
- name: Build and push
72+
uses: docker/build-push-action@v3
73+
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-wordpress'
74+
with:
75+
context: ${{ matrix.version }}${{ matrix.type }}
76+
platforms: linux/amd64,linux/arm64
77+
push: true
78+
tags: kooldev/wordpress:${{ matrix.version }}${{ matrix.type }}
79+
80+
- name: Build and push (nginx)
81+
uses: docker/build-push-action@v3
82+
if: github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-wordpress'
83+
with:
84+
context: ${{ matrix.version }}-nginx${{ matrix.type }}
85+
platforms: linux/amd64,linux/arm64
86+
push: true
87+
tags: kooldev/wordpress:${{ matrix.version }}-nginx${{ matrix.type }}

7.4-nginx-prod/entrypoint

Lines changed: 39 additions & 40 deletions
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

Lines changed: 39 additions & 40 deletions
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

0 commit comments

Comments
 (0)