Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerignore: convert to whitelist #738

Draft
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Oct 5, 2024

Update to #361

  • conflicts resolved
  • convert .dockerignore from blacklist-based to whitelist
  • decrease docker build context size significantly (most savings would come from excluding .git dirs)
  • make docker builds less dependent on local state (e.g. local node_modules in submodules)
  • add script for checking docker build context
  • add CI tests to monitor if surprisingly large changes are made to the build context

To check build context locally, run:

./test/check-docker-context.sh --report

To check against previous .dockerignore:

git checkout next -- .dockerignore && ./test/check-docker-context.sh --report

* convert dockerignore from blacklist-based to whitelist
* decrease docker build context size significantly
* make docker builds less dependent on local state (e.g. local node_modules in submodules)
* add script for checking docker build context
* add CI tests to monitor if surprisingly large changes are made to the build context
@alxndrsn alxndrsn force-pushed the test-docker-context branch from bb9f990 to 5699ebe Compare October 5, 2024 08:54
@alxndrsn alxndrsn requested review from matthew-white and removed request for matthew-white October 5, 2024 08:56
@alxndrsn
Copy link
Contributor Author

alxndrsn commented Oct 5, 2024

Unfortunately generating version.txt requires all .git directories to be included in the build context.

@alxndrsn
Copy link
Contributor Author

alxndrsn commented Oct 5, 2024

Currently, .git in published central-service images is a file:

/usr/odk# cat .git
gitdir: ../.git/modules/server

@lognaturel
Copy link
Member

Could we maybe delete it after the build step in the docker file?

@alxndrsn
Copy link
Contributor Author

alxndrsn commented Oct 7, 2024

Could we maybe delete it after the build step in the docker file?

That could be done, but the file itself looks harmless.

.dockerignore Outdated Show resolved Hide resolved
@matthew-white matthew-white changed the base branch from master to next October 8, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants