Skip to content

Fix using docker specific ignore with read-only build context#72

Merged
JaewonHur merged 10 commits into
apple:mainfrom
JaewonHur:docker-ignore-readonly-context
Apr 18, 2026
Merged

Fix using docker specific ignore with read-only build context#72
JaewonHur merged 10 commits into
apple:mainfrom
JaewonHur:docker-ignore-readonly-context

Conversation

@JaewonHur

Copy link
Copy Markdown
Contributor

This PR resolves the issue when using docker specific ignore file with read-only build context (apple/container#1343).

Once the dockerignore argument is provided in PerformBuild gRPC, it performs following two operations.

First, after unpacking transferred build context archive into cache directory, it creates a DockerfileStaging (i.e., .com.apple.container) directory there, and copies Dockerfile and Dockerfile.dockerignore. The path to DockerfileStaging is passed to the buildkit daemon so that it can correctly figure out which dockerignore file to read.

Second, it handles data requests for Dockerfile and Dockerfile.dockerignore (i.e., diffcopy.go:sender::sendFile), so that the requests before the actual files are written can be correctly served---i.e., refer #71 for more context about this race issue.

@JaewonHur JaewonHur changed the title Docker ignore readonly context Fix using docker specific ignore with read-only context Mar 25, 2026
@JaewonHur JaewonHur changed the title Fix using docker specific ignore with read-only context Fix using docker specific ignore with read-only build context Mar 25, 2026
@JaewonHur

Copy link
Copy Markdown
Contributor Author

@saehejkang Hi! If you have time, could you give a review on this PR?

Comment thread pkg/fileutils/tarxfer.go Outdated
Comment thread pkg/fileutils/tarxfer.go Outdated
Comment thread pkg/fssync/fssync.go
"google.golang.org/grpc"
)

const DockerfileStaging = fileutils.DockerfileStaging

@saehejkang saehejkang Apr 16, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this const can be shared with other files in this package, this might live better in the file that uses it (diffcopy.go)?

EDIT: I can see why it lives here if you wanted files in other packages to import fssync for readability

EDIT 2: On second thought, what if in another issue/PR we create a dedicated file for all the constants to live?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I also thought it'd be better if we have some dedicated file for all the constants :)
We can work on it later when we hit more use cases.

@saehejkang

Copy link
Copy Markdown
Contributor

Hi! If you have time, could you give a review on this PR?

Tried my best to gain as much context as possible, before I went through your changes. Other than the comments above, nothing looks out of the ordinary to me.

@JaewonHur

Copy link
Copy Markdown
Contributor Author

Tried my best to gain as much context as possible, before I went through your changes. Other than the comments above, nothing looks out of the ordinary to me.

I really appreciate for your time! Thanks!

JaewonHur and others added 2 commits April 16, 2026 09:26
Co-authored-by: Saehej Kang <20051028+saehejkang@users.noreply.github.com>
Co-authored-by: Saehej Kang <20051028+saehejkang@users.noreply.github.com>
@saehejkang

Copy link
Copy Markdown
Contributor

I really appreciate for your time! Thanks!

lol there was no need to add me as co-author on the most recent commits 😅

@JaewonHur JaewonHur merged commit 0bae72e into apple:main Apr 18, 2026
2 checks passed
JaewonHur added a commit to apple/container that referenced this pull request Apr 20, 2026
This PR resolves #1343.
This PR depends on apple/container-builder-shim#72.

Do not create staging directory under build context, but pass
dockerignore file bytes to the container-builder-shim.

## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
[Why is this change needed?]

## Testing
- [x] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
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.

4 participants