Dockerfile with 2 x FROM sources
I've seen a few interesting FOSS apps which in their Dockerfiles have 2
FROM elixir:1.12-alpine as build ... ... FROM elixir:1.12-alpine ... ...
Ignoring that these examples are not the Cloudron base images, just wondering how this might be handled in building a Cloudron package. Is it possible ?
Probably going will turn out to be a dumb question : humour the newbie
@timconsidine This is just a Docker syntax that allow you to have a temporary container that does some stuff (usually building things), then you can access files built during previous steps in subsequent ones and add them to your image.
Basically, it's just a way to simplify cleanup : instead of installing a bunch of tools that you only need during build time, then having to remove them (or worse, leave them in the final image), you can do the build in the temporary container, then import the build results in the final container.
timconsidine last edited by timconsidine
@mehdi thanks for the explanation
Maybe I will get brave and try it out on a project
This style is called multistage builds, if you want to search/read more. FWIW, they will work fine on Cloudron, we use standard docker images. That all our apps use
cloudron/base:3.2.0as the base image is only a convention that helps us maintain things more easily. (as in, if each each app package had it's own coding style and convention, it becomes hard for us to navigate the code and update them).
@girish thanks, will research and play around a bit
@timconsidine Multi stage builds are super easy to use. As long as binaries are compatible, you could even pull binaries from pre existing containers.
I’m doing the same in https://github.com/fbartels/cloudron-drone-app/blob/master/Dockerfile
@fbartels thanks, nice example