From 6a06d0819a2058e7b3d6f8686a1077dc949a22a6 Mon Sep 17 00:00:00 2001 From: Christopher Allford <6451942+ObliviousHarmony@users.noreply.github.com> Date: Tue, 30 May 2023 16:30:08 -0700 Subject: [PATCH] Fixed Docker Image Size Ballooning (#51034) When running `useradd` without the `-l` option it can cause certain log files to reach absurd file sizes. This option avoids writing anything to these logs. --- packages/env/CHANGELOG.md | 4 ++++ packages/env/lib/init-config.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/env/CHANGELOG.md b/packages/env/CHANGELOG.md index 1c2b35b28da947..04a2030c1ab8a3 100644 --- a/packages/env/CHANGELOG.md +++ b/packages/env/CHANGELOG.md @@ -6,6 +6,10 @@ - Execute the local package's `wp-env` instead of the globally installed version if one is available. +### Bug fix + +- Run `useradd` with `-l` option to prevent excessive Docker image sizes. + ## 8.0.0 (2023-05-24) ### Breaking Change diff --git a/packages/env/lib/init-config.js b/packages/env/lib/init-config.js index ee26ade75c665e..fad8d5b36f1834 100644 --- a/packages/env/lib/init-config.js +++ b/packages/env/lib/init-config.js @@ -133,8 +133,8 @@ ARG HOST_USERNAME ARG HOST_UID ARG HOST_GID # When the IDs are already in use we can still safely move on. -RUN groupadd -g $HOST_GID $HOST_USERNAME || true -RUN useradd -m -u $HOST_UID -g $HOST_GID $HOST_USERNAME || true +RUN groupadd -o -g $HOST_GID $HOST_USERNAME || true +RUN useradd -mlo -u $HOST_UID -g $HOST_GID $HOST_USERNAME || true # Install any dependencies we need in the container. ${ installDependencies( 'wordpress', env, config ) }`;