From b259c8d38e0f42288fd279c9f9efd3cefbc2c1cb Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 27 Aug 2021 11:30:43 +0100 Subject: [PATCH] DEV: Clean yarn cache after yarn install (#568) The cache is not required to run the application. This should make the docker image much smaller. We may want to re-evaluate this decision when switching to yarn v2, which has a very different caching system. --- image/base/Dockerfile | 1 + templates/web.template.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/image/base/Dockerfile b/image/base/Dockerfile index 09024e5..bca5e3c 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -141,5 +141,6 @@ RUN useradd discourse -s /bin/bash -m -U &&\ cd /var/www/discourse &&\ sudo -u discourse bundle install --deployment --jobs 4 --without test development &&\ sudo -u discourse yarn install --production &&\ + sudo -u discourse yarn cache clean &&\ bundle exec rake maxminddb:get &&\ find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} + diff --git a/templates/web.template.yml b/templates/web.template.yml index 53cc64d..ae50bf8 100644 --- a/templates/web.template.yml +++ b/templates/web.template.yml @@ -156,7 +156,7 @@ run: - exec: cd: $home cmd: - - "[ ! -d 'node_modules' ] || su discourse -c 'yarn install --production'" + - "[ ! -d 'node_modules' ] || su discourse -c 'yarn install --production && yarn cache clean'" - exec: cd: $home -- 2.25.1