# Shallow git fetch regression in discourse\_docker

**URL:** <https://meta.discourse.org/t/shallow-git-fetch-regression-in-discourse-docker/172324>\
**Category:** Support\
**Created:** [December 5, 2020, 11:24am UTC](https://meta.discourse.org/t/shallow-git-fetch-regression-in-discourse-docker/172324 "2020-12-05T11:24:46Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [December 7, 2020, 4:33pm UTC](https://meta.discourse.org/t/shallow-git-fetch-regression-in-discourse-docker/172324/6 "2020-12-07T16:33:21Z")

</div>

> [@lucasbasquerotto](#):
>
> Running `git fetch --all` should solve the problem, but I don’t know how much it could increase the image size (unless another instruction clears the unused references later on).

That doubles the repository size 🙁

> [@lucasbasquerotto](#):
>
> That said, I think `git clone --depth 1 https://github.com/discourse/discourse.git --branch=$version`

Problem is that at the image build time I don’t know what branch you will want in the future.

The current setup was changed to make the image size smaller, and it made the image compressed size 250MB (25%) smaller, which is a huge win. It works fine when using normal branches such as stable and beta or tests-passed.

> [@dachary](#):
>
> A [recent commit in docker\_discourse](https://github.com/discourse/discourse_docker/commit/e2eb085714dfcf2aa0117b0f2fdf39b762b0e18d) breaks the ability to specify a tag (for instance v2.6.0) in the **version:** value of **app.yml**. This is useful to [install older versions of discourse](https://meta.discourse.org/t/how-to-i-can-install-old-version-discourse/115457/6), for test purposes.

As a work-around, if you want to switch to a tag you can apply this to your app.yml file:

```diff
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
+ - exec:
+ cd: $home
+ cmd:
+ - git fetch --depth=1 origin tag v2.5.0 --no-tags
+ - git checkout v2.5.0

```

Another work-around is adding a `base_image` key to the top level of the app.yml with the value of an older base image. Since we don’t even try to keep compatibility of the new images being able to run older Discourse versions this may be necessary if you are going back long enough.

---

_[View the full topic](https://meta.discourse.org/t/shallow-git-fetch-regression-in-discourse-docker/172324)._
