Skip to content

Commit c44dced

Browse files
Change run configuration (#56)
* Replace wp-env with docker-compose * Ommit cli version * Name stack tinify * Change 60 74 * Use dockerfiles to select build version * Use external network when running in github action * replace override * Update lock file * Use aliasses * Check for install * Wait for wordpress to be ready * Set env for per variation composer project * Add healthcheck for database * use playwright directly * Change check on playwright version * Change run cmds * Use correct images * Add network name to allow mock to connect * Remove force click * Add port to localstack * Pick specifically 4.6 * Use non-https * Skip salts * Wait for selectors to appear (due to js) * await clickers * Remove wordpress-scripts * Remove images in favor of a conf map * use ge * Change wp version check
1 parent 8a39b9c commit c44dced

4 files changed

Lines changed: 24 additions & 13 deletions

File tree

bin/run-wordpress

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Usage: bin/run-wordpress [WORDPRESS_VERSION] [PHP_VERSION]
44
# Example: bin/run-wordpress 67 82
55

6+
CONFIG_FILE="config/wp-version.conf"
7+
68
# Ensure Docker CLI is installed.
79
if ! command -v docker >/dev/null; then
810
echo "Docker CLI is required."
@@ -12,16 +14,25 @@ fi
1214
WORDPRESS_VERSION_ENV="${1:-$WORDPRESS_VERSION}"
1315
PHP_VERSION_ENV="${2:-$PHP_VERSION}"
1416

17+
WP_IMAGE_KEY="${WORDPRESS_VERSION_ENV}_${PHP_VERSION_ENV}"
18+
WP_IMAGE=$(grep "^${WP_IMAGE_KEY}=" "$CONFIG_FILE" | cut -d'=' -f2)
19+
WORDPRESS_PORT="80${WORDPRESS_VERSION_ENV}"
20+
21+
if [ -z "$WP_IMAGE" ]; then
22+
echo "Unsupported version combination: $WP_IMAGE_KEY"
23+
exit 1
24+
fi
25+
1526
# Parse WordPress version parameter
1627
if [[ "$WORDPRESS_VERSION_ENV" =~ ^[0-9]{2}$ ]]; then
1728
WORDPRESS_VERSION="${WORDPRESS_VERSION_ENV:0:1}.${WORDPRESS_VERSION_ENV:1:1}"
1829
else
1930
WORDPRESS_VERSION="$WORDPRESS_VERSION_ENV"
2031
fi
2132

22-
# Exports as 8.2
2333
export WORDPRESS_VERSION
2434
export WORDPRESS_VERSION_ENV
35+
export WP_IMAGE
2536

2637
# Parse WordPress version parameter
2738
if [[ "$PHP_VERSION_ENV" =~ ^[0-9]{2}$ ]]; then
@@ -33,20 +44,10 @@ fi
3344
export PHP_VERSION
3445
export PHP_VERSION_ENV
3546

36-
: "${WORDPRESS_VERSION_ENV:=latest}" # default WordPress version shorthand
37-
: "${PHP_VERSION_ENV:=8.0}" # default PHP version shorthand
38-
39-
: "${WORDPRESS_PORT:=80${WORDPRESS_VERSION_ENV}}"
4047
export WORDPRESS_PORT
4148

4249
export COMPOSE_PROJECT_NAME="tinify_${WORDPRESS_VERSION_ENV}_${PHP_VERSION_ENV}"
4350

44-
DOCKERFILE_PATH="./config/docker/${WORDPRESS_VERSION_ENV}-${PHP_VERSION_ENV}.Dockerfile"
45-
if [ ! -f "$DOCKERFILE_PATH" ]; then
46-
echo "No Docker file available: $DOCKERFILE_PATH"
47-
exit 1
48-
fi
49-
5051
echo "Starting Docker environment with WordPress $WORDPRESS_VERSION and PHP $PHP_VERSION..."
5152
docker compose -f config/docker-compose.yml up -d
5253

bin/stop-wordpress

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export WORDPRESS_VERSION_ENV
88
PHP_VERSION_ENV="${2:-$PHP_VERSION}"
99
export PHP_VERSION_ENV
1010

11+
WP_IMAGE=""
12+
export WP_IMAGE
13+
1114
export COMPOSE_PROJECT_NAME="tinify_${WORDPRESS_VERSION_ENV}_${PHP_VERSION_ENV}"
1215

1316
docker compose -f config/docker-compose.yml down -v

config/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ services:
2222
wordpress:
2323
depends_on:
2424
- db
25-
build:
26-
dockerfile: docker/${WORDPRESS_VERSION_ENV}-${PHP_VERSION_ENV}.Dockerfile
25+
image: ${WP_IMAGE}
2726
environment:
2827
WORDPRESS_DB_HOST: db:3306
2928
WORDPRESS_DB_USER: wordpress

config/wp-version.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Format: WPVERSION_PHPVERSION=DOCKER_IMAGE
2+
46_56=wordpress:4.6-php5.6-apache
3+
46_70=wordpress:4.6-php7.0-apache
4+
57_73=wordpress:5.7-php7.3-apache
5+
60_74=wordpress:6.0-php7.4-apache
6+
63_80=wordpress:6.3-php8.0-apache
7+
67_82=wordpress:6.7-php8.2-apache
8+
68_83=wordpress:6.8-php8.3-apache

0 commit comments

Comments
 (0)