From 96bc01a3ae18c6bdecfd7741f9b8457d6a267c2e Mon Sep 17 00:00:00 2001 From: Chris Raible Date: Tue, 18 Feb 2025 18:09:47 -0800 Subject: [PATCH] Reduced the size of the development docker image by ~100 MB (#22226) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue - This commit includes a few minor optimizations to the Dockerfile - Removes `/var/lib/apt/lists` and runs `apt clean` to remove the apt cache after each `apt install ...` command. This reduces the resulting image size by about 100 MB - Also moved the playwright install to after the `package.json` and `yarn.lock` files are copied in, so we don't have to specifically pin the version in the Dockerfile — it will instead just look at the version specified in the `package.json` files. --- .docker/Dockerfile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 12e3b60568..47e8e5cca5 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -11,7 +11,9 @@ RUN apt-get update && \ jq \ libjemalloc2 \ python3 \ - tar + tar && \ + rm -rf /var/lib/apt/lists/* && \ + apt clean # Development Base Image ## This stage adds development specific packages like the Stripe CLI, zsh, playwright, etc. @@ -24,10 +26,9 @@ RUN curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/publ apt install -y \ git \ stripe \ - zsh \ - procps \ - default-mysql-client && \ - npx -y playwright@1.50.1 install --with-deps + procps && \ + rm -rf /var/lib/apt/lists/* && \ + apt clean # DevContainer Stage: Install dependencies and copy the code ## This stage is used for local development @@ -145,10 +146,12 @@ COPY ghost/verification-trigger/package.json ghost/verification-trigger/package. COPY ghost/version-notifications-data-service/package.json ghost/version-notifications-data-service/package.json COPY ghost/webmentions/package.json ghost/webmentions/package.json - ## Install dependencies RUN yarn install --frozen-lockfile --prefer-offline +## Install playwright w/ dependencies +RUN npx -y playwright install --with-deps + ## Copy the rest of the code COPY . .