package icon indicating copy to clipboard operation
package copied to clipboard

Golang Docker image size

Open radu-matei opened this issue 8 years ago • 5 comments

The size of the Golang Docker image is large, very large (this is for a very simple application, no dependencies): screen shot 2018-01-29 at 17 17 21

This makes the pushing/pulling of the image take a significant amount of time - is there any area we might improve here?

(Is it the same with other languages?)

radu-matei avatar Jan 29 '18 15:01 radu-matei

Maybe due to initialising the go dep package? Dockerfile has...

RUN go get -u github.com/golang/dep/cmd/dep

RUN dep init

If that is the case, maybe there could be a base metaparticle aci container base image to speed things up?

srini85 avatar Jan 29 '18 18:01 srini85

Well, it shouldn't really be like this, you shouldn't have separate images based on the runtime (?) - the resulting Docker image is large regardless of the runtime.

(And if you haven't already pushed the base image to the registry it won't matter - and it won't matter for pulls).

It feels like a multi-stage building should improve a bit (but this is just an uninformed opinion).

Regardless, the resulting image is much too large.

radu-matei avatar Jan 29 '18 19:01 radu-matei

Initial tackle of this in 16f7a303efe76edc2ef3f8e61a8eefae81518f84 Resulting Docker image now 46 MB, still to go on improvements :)

screen shot 2018-01-31 at 21 40 55

radu-matei avatar Jan 31 '18 19:01 radu-matei

https://github.com/metaparticle-io/package/pull/131 Should be as efficient as we can make it, squashed all layers and pulling 2mb base image. Google have their "distroless" base images designed for maximum efficiency, but I'm not sure on the legitimacy of the images.

bwoodhouse322 avatar Aug 20 '18 14:08 bwoodhouse322

gotest Got it to 6MB with help from @radu-matei

bwoodhouse322 avatar Aug 20 '18 20:08 bwoodhouse322