From ebc9089bd613cec4dcef0176c661cd8e9e20ac8a Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Sun, 8 Dec 2024 19:20:04 +0200 Subject: [PATCH] refactor(dev-env): make `wordpress` init-only container --- assets/dev-env.lando.template.yml.ejs | 12 ++++++------ src/lib/constants/dev-environment.ts | 2 +- src/lib/dev-environment/dev-environment-lando.ts | 6 +++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/assets/dev-env.lando.template.yml.ejs b/assets/dev-env.lando.template.yml.ejs index b7ab57bac..2011fecb5 100644 --- a/assets/dev-env.lando.template.yml.ejs +++ b/assets/dev-env.lando.template.yml.ejs @@ -175,8 +175,6 @@ services: type: compose services: image: ghcr.io/automattic/vip-container-images/wordpress:<%= wordpress.tag %> -# command: /usr/local/bin/entrypoint.sh - command: sh -c "rsync -a --chown=www-data:www-data /wp/ /shared/; sleep infinity" volumes: - ./wordpress:/shared - type: volume @@ -184,10 +182,12 @@ services: target: /scripts volume: nocopy: true -# environment: -# LANDO_NO_SCRIPTS: 1 -# LANDO_NEEDS_EXEC: 1 -# initOnly: true + environment: + LANDO_NO_USER_PERMS: 1 + LANDO_NO_SCRIPTS: 1 + LANDO_NEEDS_EXEC: 1 + initOnly: true + entrypoint: /usr/bin/rsync -a --chown=${LANDO_HOST_USER_ID}:${LANDO_HOST_GROUP_ID} /wp/ /shared/ <% if ( muPlugins.mode == 'image' ) { %> vip-mu-plugins: diff --git a/src/lib/constants/dev-environment.ts b/src/lib/constants/dev-environment.ts index a00b9979f..196c86fb7 100644 --- a/src/lib/constants/dev-environment.ts +++ b/src/lib/constants/dev-environment.ts @@ -49,4 +49,4 @@ export const DEV_ENVIRONMENT_DEFAULTS = { phpVersion: Object.keys( DEV_ENVIRONMENT_PHP_VERSIONS )[ 0 ], } as const; -export const DEV_ENVIRONMENT_VERSION = '2.1.2'; +export const DEV_ENVIRONMENT_VERSION = '2.1.3'; diff --git a/src/lib/dev-environment/dev-environment-lando.ts b/src/lib/dev-environment/dev-environment-lando.ts index 0d6c7090f..dcc8c5bde 100644 --- a/src/lib/dev-environment/dev-environment-lando.ts +++ b/src/lib/dev-environment/dev-environment-lando.ts @@ -7,7 +7,7 @@ import landoUtils, { type AppInfo } from 'lando/plugins/lando-core/lib/utils'; import landoBuildTask from 'lando/plugins/lando-tooling/lib/build'; import { lookup } from 'node:dns/promises'; import { mkdir, rename } from 'node:fs/promises'; -import { tmpdir } from 'node:os'; +import { tmpdir, userInfo } from 'node:os'; import path, { dirname } from 'node:path'; import { satisfies } from 'semver'; import xdgBasedir from 'xdg-basedir'; @@ -89,6 +89,10 @@ async function getLandoConfig(): Promise< LandoConfig > { home: fakeHomeDir, domain: 'vipdev.lndo.site', version: 'unknown', + env: { + LANDO_HOST_USER_ID: process.platform === 'win32' ? '1000' : `${ userInfo().uid }`, + LANDO_HOST_GROUP_ID: process.platform === 'win32' ? '1000' : `${ userInfo().gid }`, + }, }; return buildConfig( config );