Skip to content

Increase build context warning limit to 100 #686

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

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

jordanstephens
Copy link
Member

I saw this warning while deploying the rails sample today, which is just under 100 files in the docker build context (after applying the ignore rules). It's a pretty small stock rails app, so lots of files, but also completely reasonable.

I think this warning adds more friction than value at this low limit. I propose we increase it to 100, which will get us out of the way for many legitimate use-cases while still catching problematic scenarios.

@lionello
Copy link
Member

Checking DefangLabs/samples#189, where do those 100 files come from?

The reason for the limit was that we had instances where folks did defang compose up in their Documents folder and it ended up uploading their private docs to our backend.

@raphaeltm
Copy link
Collaborator

@lionello here's just a selection of the ruby files (not comprehensive, and not including all the html templates, css, js, etc.) that are part of the sample. And it's not a complicated app:

CleanShot 2024-09-20 at 08 47 48@2x

Even the stock Next.js app that comes from npx create-next-app (before adding a single file of your own code) has more than 10 files in the build context:

CleanShot 2024-09-20 at 08 52 00@2x

On the one hand, sure we want to protect users from doing something they don't intend to. On the other hand, it feels fair to say that some of the responsibility is on them, and 10 files won't throw a warning for an extremely minimal service, but will throw a warning for many of the most popular frameworks (Next.js, Rails, Django, etc.). Even for the frameworks that don't have that many files out of the gate, I feel like it would take me less than an hour of building before I've added a dozen+ files to even a pretty minimal application.

@raphaeltm
Copy link
Collaborator

raphaeltm commented Sep 20, 2024

Maybe we can use a different metric than file count, if the thing we want to avoid is uploading the wrong files? Maybe we can run simple checks like "are there .pdf, .docx, .xlsx etc. files in this project? If so, maybe throw a warning"

@jordanstephens
Copy link
Member Author

Maybe we can use a different metric than file count, if the thing we want to avoid is uploading the wrong files? Maybe we can run simple checks like "are there .pdf, .docx, .xlsx etc. files in this project? If so, maybe throw a warning"

I think we should keep it simple. A byte size limit and a file count limit both seem reasonable, I just think the current limits are so low that friction is introduced in normal usage patterns.

@lionello lionello merged commit c5ed0c2 into main Sep 24, 2024
11 checks passed
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