Skip to content

Conversation

@tgxworld
Copy link
Contributor

I noticed that use running git reset --hard results in ~133MB being
added to the final layer generated by launcher bootstrap. However, I
can not figure out why we would need to run git reset --hard at all.

Even if there is a reason to run git reset --hard, it should not be
the default. If someone for whatever reason needs to run git reset --hard, they should do so using the before_code hook.

To replicate the problem, one can run the following steps:

  1. In the discourse_docker repository, create a file named containers/test.yml with the following contents:
base_image: discourse/base:2.0.20241223-0016

run:
  - exec: sudo -H -E -u discourse bash -c "cd /var/www/discourse && git reset --hard"
  1. Run ./launcher bootstrap test
  2. Run docker history local_discourse/test and see that the new layer created by ./launcher bootstrap is roughly 133MB.
IMAGE          CREATED         CREATED BY                                      SIZE      COMMENT
012471f3c5e4   2 minutes ago   /bin/bash -c /usr/local/bin/pups --stdin        133MB

I noticed that use running `git reset --hard` results in ~133MB being
added to the final layer generated by `launcher bootstrap`. However, I
can not figure out why we would need to run `git reset --hard` at all.

Even if there is a reason to run `git reset --hard`, it should not be
the default. If someone for whatever reason needs to run `git reset
--hard`, they should do so using the `before_code` hook.
@tgxworld tgxworld merged commit 7cd3dce into main Dec 23, 2024
3 checks passed
@tgxworld tgxworld deleted the remove_git_reset_hard branch December 23, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants