Search code examples
buildpackpaketo

Buildpacks Distroless runtime image support


Is it possible to use distroless image with buildpacks ?


Solution

  • It's not necessarily an easy question and it depends.

    You are able to create a custom stack and custom builder, which you can base off distroless.

    If you're unsure about these buildpack terms, the stack provides the base images for building and running applications. The builder is the combination of the stack plus a set of buildpacks that can run on that stack.

    So in theory, the answer to your question is yes. Where it becomes difficult to answer is that you haven't indicated anything about your application (language/runtime?) or the buildpacks (heroku, paketo, etc?) you need to run. Your application, language runtime, and buildpacks will need to be able to run on distroless, which isn't trivial because it is an extremely spartan container image.

    In short, you'll need to update the question to provide more details about your app and the buildpacks you want to run to get a more definitive answer.


    Taking a guess here, if you are running Paketo buildpacks, what I can say is that Paketo provides a "tiny" image (less than 20M) that is similar to distroless. You could a.) look at using the tiny stack as all the hard work is done for you or b.) if you really need distroless, you could try to base your work off the tiny stack. Because that's also a stripped-down image, the buildpacks and apps you can run on tiny are likely similar to what you could run on distroless.

    You can find the tiny builder definition here and you can find tiny stack releases here and tiny stack source here.