jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
8.2k stars 192 forks source link

Allow a way to use buildLayeredImage #1946

Open andr-ec opened 4 months ago

andr-ec commented 4 months ago

What problem are you trying to solve?

I want to be able to create docker images that are deterministic and reduce the amount of layers that need to be sent to the registry. similar to how is explained in this article: https://xeiaso.net/talks/2024/nix-docker-build/

What solution would you like?

Ideally a command that builds the docker image that is ready to be uploaded to a registry. but it would also be ok if it output a nix file configured with all the existing inputs that has buildLayeredImage implemented.

Since cross compilation is hard it would be fine if it only worked on linux since in our use case it would only be run in ci.

Alternatives you've considered

The current docker generate works but isn't as minimal or as optimal as using buildLayeredImage directly with nix.

mohsenari commented 4 months ago

I saw that and it seems like a very good idea. I need to do some testing to make sure an image built on MacOS can be used in Linux. Or if not what is the workaround.

nhuray commented 4 months ago

I have exactly the same need.

I would like to build a docker image defining a single layer with all the devbox dependencies.

This base image would be used to build other docker images in a multi-stage build. That base image might also be used in Github action as a container as an alternative to the devbox-install-action.

apgrucza commented 2 months ago

Hopefully this would result in smaller Docker images too, because I'm finding my CI takes a very long time to pull large images produced via devbox generate dockerfile.