From e2eb085714dfcf2aa0117b0f2fdf39b762b0e18d Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 25 Nov 2020 18:51:01 -0300 Subject: [PATCH] FEATURE: Use a shallow clone for Discourse core This reduces final compressed image size in 25%. --- image/base/Dockerfile | 2 +- templates/web.template.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/image/base/Dockerfile b/image/base/Dockerfile index 518594e..724025f 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -140,7 +140,7 @@ ADD cron.d_anacron /etc/cron.d/anacron RUN useradd discourse -s /bin/bash -m -U &&\ mkdir -p /var/www &&\ cd /var/www &&\ - git clone https://github.com/discourse/discourse.git &&\ + git clone --depth 1 https://github.com/discourse/discourse.git &&\ cd discourse &&\ git remote set-branches --add origin tests-passed &&\ chown -R discourse:discourse /var/www/discourse &&\ diff --git a/templates/web.template.yml b/templates/web.template.yml index 8bd5343..eb377ae 100644 --- a/templates/web.template.yml +++ b/templates/web.template.yml @@ -90,7 +90,8 @@ run: - git clean -f - git remote set-branches --add origin master - git pull - - git fetch origin $version + - git remote set-branches origin $version + - git fetch --depth 1 origin $version - git checkout $version - mkdir -p tmp - chown discourse:www-data tmp -- 2.25.1