pelias / polylines

Pelias import pipeline for polyline (road network) data.
MIT License
17 stars 24 forks source link

Use multistage build to bring in `pbf` executable #263

Closed orangejulius closed 2 years ago

orangejulius commented 2 years ago

The polylines Docker image is a bit of a large one currently, as it includes not just Node.js and a node_modules directory, but a full compiler toolchain, an install of the Go language, the dependencies of the pbf repository from https://github.com/missinglink/pbf, and the final pbf executable that comes from it.

All told, this brought the total image size to a whopping 950MB uncompressed.

This PR makes use of multi stage builds to run the compiling of the pbf executable in a separate container. After this, all the toolchain and dependencies needed can be thrown away, and only the small executable copied to the final image.

Using container-diff it looks like the image size, uncompressed, after https://github.com/pelias/docker-baseimage/pull/23 as well, will be only 322MB. That's a nice 600MB savings!

Before https://github.com/pelias/docker-baseimage/pull/23 the image size still drops to 500MB, also a healthy reduction.

Replaces https://github.com/pelias/polylines/pull/262

missinglink commented 2 years ago

Yeah very nice

orangejulius commented 2 years ago

Some quick notes: