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

Exclude node headers #1597

Merged

Conversation

omBratteng
Copy link
Contributor

No description provided.

Copy link
Member

@loosebazooka loosebazooka left a comment

Choose a reason for hiding this comment

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

So these are not necessary at runtime?

@omBratteng
Copy link
Contributor Author

So these are not necessary at runtime?

I will do some testing, but I am pretty sure these are not needed. It is just .h header files. They could probably be necessary when you install packages that needs compilation, but without npm (or shell), it's not possible

@omBratteng
Copy link
Contributor Author

@loosebazooka I've changed the glob in pkg_tar for node, instead of excluding all the files, I am only including the LICENSE file and node binary.

Seeing as @pkwarren just pull the binary from the image in this PR bufbuild/plugins#1118, I think it should work fine just include the binary and license.

@omBratteng omBratteng marked this pull request as ready for review May 16, 2024 11:32
@loosebazooka
Copy link
Member

loosebazooka commented May 20, 2024

@omBratteng I'm going to do a little research before I merge this. I'm afraid of breaking all the node users. But it looks fine otherwise. I will most like merge this tomorrow.

@omBratteng
Copy link
Contributor Author

That's fine, and makes sense

@ianlewis
Copy link

@omBratteng I'm going to do a little research before I merge this. I'm afraid of breaking all the node users. But it looks fine otherwise. I will most like merge this tomorrow.

I think this should be fine but agree that it should be tested. I'm not sure how distroless expects folks to include projects with dependencies that were compiled but I assume it would use the JavaScript build rules which wouldn't use the runtime that's included in the resulting image.

@omBratteng
Copy link
Contributor Author

@omBratteng I'm going to do a little research before I merge this. I'm afraid of breaking all the node users. But it looks fine otherwise. I will most like merge this tomorrow.

I think this should be fine but agree that it should be tested. I'm not sure how distroless expects folks to include projects with dependencies that were compiled but I assume it would use the JavaScript build rules which wouldn't use the runtime that's included in the resulting image.

Usually the way I've done it, is not with bazel. So I just use official node images with debian to install dependencies and build the code, then copy the node_modules directory and any other built files.
In 99% of cases, that does include everything you might need.

@loosebazooka
Copy link
Member

yeah we're not expecting anyone to use distroless images as build time images, they should be using fully featured build containers -- distroless is exclusively for runtime. An alternative is the debug images keeping those tools and stuff. I'll go ahead and merge this.

@loosebazooka loosebazooka merged commit 1777453 into GoogleContainerTools:main May 21, 2024
6 of 7 checks passed
@omBratteng omBratteng deleted the remove-node-headers branch May 22, 2024 10:04
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