How to reduce Docker image size for Rails and Elixir

we are actually using multi-stage Dockerfiles to reduce the size of images (something similar to this ). For example on Rails we don’t need nodejs after the assets are compiled.

Is there a way we can obtain a similar build pattern with Habitat?

The current Docker exporter doesn’t do anything with multi-stage Dockerfiles. That being said, it only includes the Supervisor, the service you’re exporting, and all its runtime dependencies, so there’s not much at all in the way of unnecessary extras being baked into the image.

You may be interested in, though.

1 Like

@christophermaier is correct. Make sure node is in your pkg_build_deps and it won’t be included in the resulting container