kshitij10496 / hercules

The mighty hero helping you build projects on top of IIT Kharagpur's academic data
https://hercules-10496.herokuapp.com/api/v1/static/index.html
MIT License
34 stars 18 forks source link

feat(docker): reduce the docker image by using multistage #31

Closed lhauspie closed 5 years ago

lhauspie commented 5 years ago

Image before the PR:

hercules          latest          d92999095a87          28 seconds ago          790MB

Image after the PR:

hercules          latest          771951a7056b          6 seconds ago          14.9MB

How it works ?

By using Mulitstage Dockerfile you can define several docker images and copy/paste files from one of them to another. By this way it's possible to have a first image that build the binary of Hercules (From golang) and a second to execute the binary (From scratch or alpine) to reduce the size of the final docker image.

Reference

https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds

lhauspie commented 5 years ago

Is there something more to do on my side to make this PR Merged ?

thealphadollar commented 5 years ago

No, not in my opinion atleast. Please wait for @kshitij10496 to review :D

kshitij10496 commented 5 years ago

This looks really good @lhauspie! 😄 Thanks.