dockerfile: avoid accessing context local if unused
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Description
While looking at some provenance attestations, I noticed that when building from local dockerfile that doesn't use anything from build context, the local source for context is still captured. This happens because the frontend always tries to read the .dockerignore file before calling Dockerfile2LLB.
We could avoid this by moving dockerignore loading into a callback for this case that is only called if there is a request to actually load any files from the build context.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the frontend path around Dockerfile2LLB and trace how .dockerignore is loaded before the Dockerfile is processed. Confirm where build-context file requests are made. Done means a Dockerfile that uses no context files does not load or capture the local context, while builds that request context files still load .dockerignore correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, dockerfile, go
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100