Skip to content

Commit b38e36a

Browse files
committed
refactor!: Publish WP-CLI as a separate image
1 parent acf55f3 commit b38e36a

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
name: Build and Publish Docker Image
1+
name: Build and Publish Docker Images
22

33
on:
44
workflow_dispatch:
55

66
env:
77
REGISTRY: ghcr.io
88
IMAGE_NAME: webstudiobond/wordpress
9+
IMAGE_CLI_NAME: webstudiobond/wp-cli
910

1011
permissions:
1112
contents: read
@@ -19,6 +20,7 @@ jobs:
1920
wp_ver: ${{ steps.extract.outputs.wp_ver }}
2021
wpcli_ver: ${{ steps.extract.outputs.wpcli_ver }}
2122
image_base: ${{ steps.extract.outputs.image_base }}
23+
cli_image_base: ${{ steps.extract.outputs.cli_image_base }}
2224
steps:
2325
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2426

@@ -28,13 +30,15 @@ jobs:
2830
WP_VER=$(sed -nE 's/^FROM wordpress:([0-9]+(\.[0-9]+)+).* AS wordpress-donor.*/\1/p' Dockerfile)
2931
WPCLI_VER=$(sed -nE 's/^FROM wordpress:cli-([0-9]+(\.[0-9]+)+).* AS wpcli-donor.*/\1/p' Dockerfile)
3032
IMAGE_BASE=$(echo "${REGISTRY}/${IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')
33+
CLI_IMAGE_BASE=$(echo "${REGISTRY}/${IMAGE_CLI_NAME}" | tr '[:upper:]' '[:lower:]')
3134
3235
[ -n "${WP_VER}" ] || { echo "ERROR: failed to parse WordPress version"; exit 1; }
3336
[ -n "${WPCLI_VER}" ] || { echo "ERROR: failed to parse WP-CLI version"; exit 1; }
3437
3538
echo "wp_ver=${WP_VER}" >> "$GITHUB_OUTPUT"
3639
echo "wpcli_ver=${WPCLI_VER}" >> "$GITHUB_OUTPUT"
3740
echo "image_base=${IMAGE_BASE}" >> "$GITHUB_OUTPUT"
41+
echo "cli_image_base=${CLI_IMAGE_BASE}" >> "$GITHUB_OUTPUT"
3842
3943
build:
4044
name: Build (${{ matrix.platform }})
@@ -92,7 +96,7 @@ jobs:
9296
push: true
9397
platforms: ${{ matrix.platform }}
9498
tags: |
95-
${{ needs.prepare.outputs.image_base }}:cli-${{ needs.prepare.outputs.wpcli_ver }}${{ matrix.push_tag_suffix }}
99+
${{ needs.prepare.outputs.cli_image_base }}:${{ needs.prepare.outputs.wpcli_ver }}${{ matrix.push_tag_suffix }}
96100
provenance: false
97101
labels: |
98102
org.opencontainers.image.title=WordPress CLI
@@ -130,12 +134,11 @@ jobs:
130134
131135
- name: Create CLI multi-arch manifest
132136
run: |
133-
BASE=${{ needs.prepare.outputs.image_base }}
137+
BASE=${{ needs.prepare.outputs.cli_image_base }}
134138
CLI_VER=${{ needs.prepare.outputs.wpcli_ver }}
135139
136140
docker buildx imagetools create \
137-
--tag "${BASE}:cli-${CLI_VER}" \
138-
--tag "${BASE}:cli-latest" \
139-
--tag "${BASE}:cli" \
140-
"${BASE}:cli-${CLI_VER}-amd64" \
141-
"${BASE}:cli-${CLI_VER}-arm64"
141+
--tag "${BASE}:${CLI_VER}" \
142+
--tag "${BASE}:latest" \
143+
"${BASE}:${CLI_VER}-amd64" \
144+
"${BASE}:${CLI_VER}-arm64"

‎docker-compose.dev.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ services:
181181
build:
182182
context: .
183183
target: cli
184-
image: wordpress:dev-cli
184+
image: wp-cli:dev
185185
container_name: "${SITE_USER}_wp-cli"
186186
hostname: "${SITE_USER}-wp-cli"
187187
profiles:

‎docker-compose.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ services:
175175
max-file: "3"
176176

177177
wp-cli:
178-
image: ghcr.io/webstudiobond/wordpress:cli-${WP_CLI_VERSION:-latest}
178+
image: ghcr.io/webstudiobond/wp-cli:${WP_CLI_VERSION:-latest}
179179
container_name: "${SITE_USER}_wp-cli"
180180
hostname: "${SITE_USER}-wp-cli"
181181
profiles:

0 commit comments

Comments
 (0)