Skip to content

Commit f617589

Browse files
authored
Merge pull request #421 from Automattic/add-wpvip-integrations-base
feat: add `wpvip-integrations-base` image
2 parents a91c6c8 + 450e19c commit f617589

File tree

5 files changed

+133
-2
lines changed

5 files changed

+133
-2
lines changed

.github/workflows/build-push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Push Base Image
1+
name: Build and Push Images
22

33
on:
44
push:

.github/workflows/build.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Base Image
1+
name: Build images
22

33
on:
44
pull_request:
@@ -24,6 +24,19 @@ jobs:
2424
id: set-matrix
2525
run: echo images="$(jq '."x-build"' base-images/src/*/.devcontainer.json | jq --slurp -c .)" >> "${GITHUB_OUTPUT}"
2626

27+
prepare-others:
28+
name: Prepare list of other images to build
29+
runs-on: ubuntu-latest
30+
outputs:
31+
images: ${{ steps.set-matrix.outputs.images }}
32+
steps:
33+
- name: Check out the source code
34+
uses: actions/checkout@v4.2.2
35+
36+
- name: Set matrix
37+
id: set-matrix
38+
run: echo images="$(jq '."x-build"' images/src/*/.devcontainer.json | jq --slurp -c .)" >> "${GITHUB_OUTPUT}"
39+
2740
build:
2841
needs: prepare
2942
strategy:
@@ -76,3 +89,59 @@ jobs:
7689
--cache-from type=gha \
7790
--cache-to type=gha,mode=max
7891
if: steps.changes.outputs.needs_build == 'true'
92+
93+
build-other-images:
94+
needs:
95+
- prepare-others
96+
name: 'Build image ${{ matrix.image.name }}'
97+
runs-on: ubuntu-latest
98+
permissions:
99+
contents: read
100+
packages: write
101+
strategy:
102+
fail-fast: false
103+
matrix:
104+
image: ${{ fromJson(needs.prepare-others.outputs.images) }}
105+
steps:
106+
- name: Check out the repo
107+
uses: actions/checkout@v4.2.2
108+
with:
109+
fetch-depth: 0
110+
111+
- name: Check changed files
112+
id: changes
113+
run: |
114+
base="${{ github.event.pull_request.base.sha }}"
115+
head="${{ github.event.pull_request.head.sha }}"
116+
image="images/src/${{ matrix.image.image-name }}"
117+
changes="$(git diff --name-only "${base}" "${head}" -- "${image}" | grep -Fv "${image}/README.md" || true)"
118+
if [ -n "${changes}" ]; then
119+
echo needs_build=true >> "${GITHUB_OUTPUT}"
120+
else
121+
echo needs_build=false >> "${GITHUB_OUTPUT}"
122+
fi
123+
124+
- name: Expose GitHub Runtime
125+
uses: Automattic/vip-actions/expose-github-runtime@e1faabf165941008de4c0c1381df153e49d8ad2c # v0.6.0
126+
127+
- name: Set up QEMU
128+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
129+
if: steps.changes.outputs.needs_build == 'true'
130+
131+
- name: Set up Docker Buildx
132+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
133+
if: steps.changes.outputs.needs_build == 'true'
134+
135+
- name: Install @devcontainers/cli
136+
run: npm install -g @devcontainers/cli
137+
if: ${{ steps.changes.outputs.needs_build == 'true' }}
138+
139+
- name: Build image
140+
run: |
141+
devcontainer build \
142+
--workspace-folder images/src/${{ matrix.image.image-name }} \
143+
--platform linux/amd64,linux/arm64 \
144+
--output type=image \
145+
--cache-from type=gha \
146+
--cache-to type=gha,mode=max
147+
if: ${{ steps.changes.outputs.needs_build == 'true' }}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"build": {
3+
"dockerfile": "./Dockerfile",
4+
"context": "."
5+
},
6+
"x-build": {
7+
"name": "WPVIP Integrations",
8+
"image-name": "wpvip-integrations-base",
9+
"image-version": "0.0.1"
10+
},
11+
"remoteUser": "vscode",
12+
"updateContentCommand": "/usr/local/bin/update-content.sh",
13+
"features": {
14+
"ghcr.io/automattic/vip-codespaces/base:latest": {},
15+
"ghcr.io/automattic/vip-codespaces/entrypoints:latest": {},
16+
"ghcr.io/automattic/vip-codespaces/nginx:latest": {},
17+
"ghcr.io/automattic/vip-codespaces/php:latest": {},
18+
"ghcr.io/automattic/vip-codespaces/mariadb:latest": {
19+
"installDatabaseToWorkspaces": true
20+
},
21+
"ghcr.io/automattic/vip-codespaces/wp-cli:latest": {},
22+
"ghcr.io/automattic/vip-codespaces/memcached:latest": {},
23+
"ghcr.io/automattic/vip-codespaces/vip-cli:latest": {},
24+
"ghcr.io/automattic/vip-codespaces/mailpit:latest": {},
25+
"ghcr.io/automattic/vip-codespaces/phpmyadmin:latest": {
26+
"enabled": true
27+
},
28+
"ghcr.io/automattic/vip-codespaces/xdebug:latest": {
29+
"enabled": true,
30+
"mode": "debug"
31+
},
32+
"ghcr.io/automattic/vip-codespaces/desktop-lite:latest": {},
33+
"ghcr.io/automattic/vip-codespaces/playwright:latest": {},
34+
"ghcr.io/automattic/vip-codespaces/wptl:latest": {}
35+
},
36+
"customizations": {
37+
"vscode": {
38+
"extensions": [
39+
"dlech.chmod",
40+
"dbaeumer.vscode-eslint",
41+
"GitHub.copilot",
42+
"esbenp.prettier-vscode",
43+
"timonwong.shellcheck",
44+
"ms-azuretools.vscode-docker",
45+
"zhiayang.tabindentspacealign",
46+
"emilast.LogFileHighlighter",
47+
"automattic.logwatcher"
48+
]
49+
}
50+
}
51+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ghcr.io/automattic/vip-codespaces/ubuntu-base:latest@sha256:267898190c939ea82909113bd957cf97d213135c4dcbb277678f9f8f20a6b4c9
2+
3+
COPY update-content.sh /usr/local/bin/update-content.sh
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
use-wptl latest
4+
if [ -d node_modules ]; then
5+
npm install
6+
else
7+
npm ci
8+
fi

0 commit comments

Comments
 (0)