Skip to content

Commit 5a87725

Browse files
committed
Build/Test Tools: Improve devcontainer setup for non-Codespaces usage
This now runs in local Docker as well. Sets the executable propset to explicitly identify `install-tool.sh` and `setup.sh` as executable. Unclear if this will sync via the Git mirror; ideally it would as otherwise the two files show as modified in a Git clone even in a fresh container. Props samruddhikhandale. See #57187. git-svn-id: https://develop.svn.wordpress.org/trunk@55353 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 8d3009d commit 5a87725

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "WordPress Core Development",
44
"dockerComposeFile": "docker-compose.yml",
5-
"service": "wordpress",
5+
"service": "app",
66
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
77

88
// Features to add to the dev container. More info: https://containers.dev/features.

.devcontainer/docker-compose.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '3.1'
22

33
services:
4-
wordpress:
4+
app:
55
image: wordpress
66
restart: always
77
ports:
@@ -12,11 +12,11 @@ services:
1212
WORDPRESS_DB_PASSWORD: examplepass
1313
WORDPRESS_DB_NAME: exampledb
1414
volumes:
15-
- ../src:/var/www/html
15+
- ../..:/workspaces:cached
1616

1717
db:
1818
image: mariadb
19-
restart: always
19+
restart: unless-stopped
2020
environment:
2121
MYSQL_DATABASE: exampledb
2222
MYSQL_USER: exampleuser
@@ -26,5 +26,4 @@ services:
2626
- db:/var/lib/mysql
2727

2828
volumes:
29-
wordpress:
3029
db:

.devcontainer/install-tools.sh

100644100755
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.pha
77
sudo chmod +x wp-cli.phar
88
sudo mv wp-cli.phar /usr/local/bin/wp
99

10+
echo "Installing chromium..."
11+
sudo apt-get update
12+
sudo apt-get -y install --no-install-recommends chromium
13+
1014
# Copy the welcome message
1115
sudo cp .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt

.devcontainer/setup.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -eux
44

5-
if [ "${CODESPACE_NAME}" = "" ]; then
5+
if [ -z ${CODESPACE_NAME+x} ]; then
66
SITE_HOST="http://localhost:8080"
77
else
88
SITE_HOST="https://${CODESPACE_NAME}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"

0 commit comments

Comments
 (0)