Hi! 👋
Firstly, thanks for your work on this project! 🙂
I am also using GitLab CI like this person: #69864
Because my GitLab runner runs as root, I need to use a hacky solution, like below, to get wp-env to work with root. I wish there was a way to allow root via wp-env.json or via a cli flag.
Here is the diff that solved my problem:
diff --git a/node_modules/@wordpress/env/lib/runtime/docker/build-docker-compose-config.js b/node_modules/@wordpress/env/lib/runtime/docker/build-docker-compose-config.js
index 735f0c6..4234601 100644
--- a/node_modules/@wordpress/env/lib/runtime/docker/build-docker-compose-config.js
+++ b/node_modules/@wordpress/env/lib/runtime/docker/build-docker-compose-config.js
@@ -225,6 +225,7 @@ module.exports = function buildDockerComposeConfig( config ) {
...dbEnv.credentials,
...dbEnv.development,
WP_TESTS_DIR: '/wordpress-phpunit',
+ WP_CLI_ALLOW_ROOT: '1',
},
volumes: developmentMounts,
extra_hosts: [ 'host.docker.internal:host-gateway' ],
@@ -242,6 +243,7 @@ module.exports = function buildDockerComposeConfig( config ) {
...dbEnv.credentials,
...dbEnv.development,
WP_TESTS_DIR: '/wordpress-phpunit',
+ WP_CLI_ALLOW_ROOT: '1',
},
extra_hosts: [ 'host.docker.internal:host-gateway' ],
},
@@ -303,6 +305,7 @@ module.exports = function buildDockerComposeConfig( config ) {
...dbEnv.credentials,
...dbEnv.tests,
WP_TESTS_DIR: '/wordpress-phpunit',
+ WP_CLI_ALLOW_ROOT: '1',
},
volumes: testsMounts,
extra_hosts: [ 'host.docker.internal:host-gateway' ],
@@ -320,6 +323,7 @@ module.exports = function buildDockerComposeConfig( config ) {
...dbEnv.credentials,
...dbEnv.tests,
WP_TESTS_DIR: '/wordpress-phpunit',
+ WP_CLI_ALLOW_ROOT: '1',
},
extra_hosts: [ 'host.docker.internal:host-gateway' ],
};
This issue body was partially generated by patch-package.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
I am also using GitLab CI like this person: #69864
Because my GitLab runner runs as
root, I need to use a hacky solution, like below, to get wp-env to work with root. I wish there was a way to allow root viawp-env.jsonor via a cli flag.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.