File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Usage: bin/run-wpcli [WORDPRESS_VERSION] [PHP_VERSION] [COMMAND]
4+ # Example: bin/run-wpcli 67 82 "tiny optimize --attachments=123,456"
5+ # Example: bin/run-wpcli 67 82 "tiny optimize"
6+
7+
8+ CONFIG_FILE=" config/wp-version.conf"
9+ WORDPRESS_VERSION_ENV=" ${1:- $WORDPRESS_VERSION } "
10+ PHP_VERSION_ENV=" ${2:- $PHP_VERSION } "
11+
12+ WORDPRESS_PORT=" 80${WORDPRESS_VERSION_ENV} "
13+ WP_IMAGE_KEY=" ${WORDPRESS_VERSION_ENV} _${PHP_VERSION_ENV} "
14+ WP_IMAGE=$( grep " ^${WP_IMAGE_KEY} =" " $CONFIG_FILE " | cut -d' =' -f2)
15+
16+ COMMAND=${3:- " tiny --help" }
17+
18+ export WP_IMAGE
19+ export COMPOSE_PROJECT_NAME=" tinify_${WORDPRESS_VERSION_ENV} _${PHP_VERSION_ENV} "
20+ export WORDPRESS_PORT
21+
22+ docker compose -f config/docker-compose.yml run --rm wpcli wp $COMMAND
You can’t perform that action at this time.
0 commit comments