Skip to content

feat: add wpvip-integrations-base image #421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Push Base Image
name: Build and Push Images

on:
push:
Expand Down
71 changes: 70 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Base Image
name: Build images

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

prepare-others:
name: Prepare list of other images to build
runs-on: ubuntu-latest
outputs:
images: ${{ steps.set-matrix.outputs.images }}
steps:
- name: Check out the source code
uses: actions/checkout@v4.2.2

- name: Set matrix
id: set-matrix
run: echo images="$(jq '."x-build"' images/src/*/.devcontainer.json | jq --slurp -c .)" >> "${GITHUB_OUTPUT}"

build:
needs: prepare
strategy:
Expand Down Expand Up @@ -76,3 +89,59 @@ jobs:
--cache-from type=gha \
--cache-to type=gha,mode=max
if: steps.changes.outputs.needs_build == 'true'

build-other-images:
needs:
- prepare-others
name: 'Build image ${{ matrix.image.name }}'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
image: ${{ fromJson(needs.prepare-others.outputs.images) }}
steps:
- name: Check out the repo
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0

- name: Check changed files
id: changes
run: |
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
image="images/src/${{ matrix.image.image-name }}"
changes="$(git diff --name-only "${base}" "${head}" -- "${image}" | grep -Fv "${image}/README.md" || true)"
if [ -n "${changes}" ]; then
echo needs_build=true >> "${GITHUB_OUTPUT}"
else
echo needs_build=false >> "${GITHUB_OUTPUT}"
fi

- name: Expose GitHub Runtime
uses: Automattic/vip-actions/expose-github-runtime@e1faabf165941008de4c0c1381df153e49d8ad2c # v0.6.0

- name: Set up QEMU
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
if: steps.changes.outputs.needs_build == 'true'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
if: steps.changes.outputs.needs_build == 'true'

- name: Install @devcontainers/cli
run: npm install -g @devcontainers/cli
if: ${{ steps.changes.outputs.needs_build == 'true' }}

- name: Build image
run: |
devcontainer build \
--workspace-folder images/src/${{ matrix.image.image-name }} \
--platform linux/amd64,linux/arm64 \
--output type=image \
--cache-from type=gha \
--cache-to type=gha,mode=max
if: ${{ steps.changes.outputs.needs_build == 'true' }}
51 changes: 51 additions & 0 deletions images/src/wpvip-integrations-base/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},
"x-build": {
"name": "WPVIP Integrations",
"image-name": "wpvip-integrations-base",
"image-version": "0.0.1"
},
"remoteUser": "vscode",
"updateContentCommand": "/usr/local/bin/update-content.sh",
"features": {
"ghcr.io/automattic/vip-codespaces/base:latest": {},
"ghcr.io/automattic/vip-codespaces/entrypoints:latest": {},
"ghcr.io/automattic/vip-codespaces/nginx:latest": {},
"ghcr.io/automattic/vip-codespaces/php:latest": {},
"ghcr.io/automattic/vip-codespaces/mariadb:latest": {
"installDatabaseToWorkspaces": true
},
"ghcr.io/automattic/vip-codespaces/wp-cli:latest": {},
"ghcr.io/automattic/vip-codespaces/memcached:latest": {},
"ghcr.io/automattic/vip-codespaces/vip-cli:latest": {},
"ghcr.io/automattic/vip-codespaces/mailpit:latest": {},
"ghcr.io/automattic/vip-codespaces/phpmyadmin:latest": {
"enabled": true
},
"ghcr.io/automattic/vip-codespaces/xdebug:latest": {
"enabled": true,
"mode": "debug"
},
"ghcr.io/automattic/vip-codespaces/desktop-lite:latest": {},
"ghcr.io/automattic/vip-codespaces/playwright:latest": {},
"ghcr.io/automattic/vip-codespaces/wptl:latest": {}
},
"customizations": {
"vscode": {
"extensions": [
"dlech.chmod",
"dbaeumer.vscode-eslint",
"GitHub.copilot",
"esbenp.prettier-vscode",
"timonwong.shellcheck",
"ms-azuretools.vscode-docker",
"zhiayang.tabindentspacealign",
"emilast.LogFileHighlighter",
"automattic.logwatcher"
]
}
}
}
3 changes: 3 additions & 0 deletions images/src/wpvip-integrations-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ghcr.io/automattic/vip-codespaces/ubuntu-base:latest@sha256:267898190c939ea82909113bd957cf97d213135c4dcbb277678f9f8f20a6b4c9

COPY update-content.sh /usr/local/bin/update-content.sh
8 changes: 8 additions & 0 deletions images/src/wpvip-integrations-base/update-content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

use-wptl latest
if [ -d node_modules ]; then
npm install
else
npm ci
fi