docker-meteor icon indicating copy to clipboard operation
docker-meteor copied to clipboard

Utilize multi-stage builds

Open Ulexus opened this issue 6 years ago • 4 comments

Now that Docker finally supports multi-stage builds, we should use them in order to reduce the footprint of the resulting images (separating build requirements from runtime requirements).

Ulexus avatar Mar 14 '18 16:03 Ulexus

This would be really awesome.

Have the benefits of both run types.

The easy (and reproducible) container from Source mode, but still the small final size of the Pre-bundled mode.

smeijer avatar Sep 29 '18 10:09 smeijer

This appears to not be quite as simple as I had hoped, but it should still be doable. I just haven't had the time to devote to it yet.

PRs always welcome. :)

Ulexus avatar Sep 29 '18 16:09 Ulexus

Can you tell a little about the struggle you've been experiencing? Perhaps sharing the knowledge can lead to a solution.

smeijer avatar Sep 29 '18 19:09 smeijer

Essentially, the later versions of meteor expect to compile dependencies on the deployment machine. This used to be done preliminarily during the bundling phase, but more and more often, run-time compilation is needed.

In some respects, multi-stage builds will actually help this. Most of the mismatches have been caused by people creating the bundle on one architecture and deploying on another, mandating recompilation. A multi-stage build would mostly fix this kind of problem, since it would be expected that the same architecture would be used for building the container image as for running.

I just haven't done any testing to see if that is sufficient.

Ulexus avatar Sep 29 '18 21:09 Ulexus