Skip to content

Commit

Permalink
@wordpress/env: Use user with UID=33 to run WP CLI commands
Browse files Browse the repository at this point in the history
The www-data user in wordpress:cli has a different UID (82) to the
www-data user in wordpress (33). Ensure we use the wordpress www-data
user for CLI commands.

See docker-library/wordpress#256 for more
discussion.
  • Loading branch information
noisysocks committed Feb 24, 2020
1 parent fbbbac2 commit 9e01181
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/env/lib/build-docker-compose-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ module.exports = function buildDockerComposeConfig( config ) {
const developmentPorts = `\${WP_ENV_PORT:-${ config.port }}:80`;
const testsPorts = `\${WP_ENV_TESTS_PORT:-${ config.testsPort }}:80`;

// The www-data user in wordpress:cli has a different UID (82) to the
// www-data user in wordpress (33). Ensure we use the wordpress www-data
// user for CLI commands.
// https://github.com/docker-library/wordpress/issues/256
const cliUser = '33:33';

return {
version: '3.7',
services: {
Expand Down Expand Up @@ -86,11 +92,13 @@ module.exports = function buildDockerComposeConfig( config ) {
depends_on: [ 'wordpress' ],
image: 'wordpress:cli',
volumes: developmentMounts,
user: cliUser,
},
'tests-cli': {
depends_on: [ 'wordpress' ],
image: 'wordpress:cli',
volumes: testsMounts,
user: cliUser,
},
composer: {
image: 'composer',
Expand Down

0 comments on commit 9e01181

Please sign in to comment.