CyCoreSystems / docker-meteor

Dockerfile and script for running Meteor on Docker
MIT License
120 stars 73 forks source link

Utilize multi-stage builds #58

Open Ulexus opened 6 years ago

Ulexus commented 6 years ago

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).

smeijer commented 5 years ago

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.

Ulexus commented 5 years ago

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. :)

smeijer commented 5 years ago

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

Ulexus commented 5 years ago

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.