toggler-io / toggler

toggler is a feature flag service to decouple deployment, feature enrollment and experiments
GNU Affero General Public License v3.0
30 stars 2 forks source link

Using multi-stage builds to reduce container image size #2

Closed sleeping-barber closed 4 years ago

sleeping-barber commented 4 years ago

Hi Adam, I was looking into your project which looks very promising to me on a technical level but also to learn about a lot of coding principles.

Trying to build the Container Image locally I was running into a couple of problems.

So I thought improving it to reduce the size from 881MB to 18.2MB.

I used multi-stage builds and instead of using go get, I thought it would be easier to just copy the code already there on the local machine (so we don't to grab it again).

Thoughts and ideas are more then welcomed, Take care!

adamluzsi commented 4 years ago

Hi Camal Cakar (@midnightrun),

First of all, thank you so much for spending your time on this, you just made my day!!! Wow, I found your solution for the Dockerfile super neat! I didn't know about multi-stage builds, and I was thinking about using the scratch with precompiled content, but I didn't wanted to have a custom build script for my Dockerfile, so I trashed the idea. And look at what you made, in my opinion, the best of both worlds without any custom build script! I'm super happy because of your PR!

Thank you so much! Feel free yo ask if you interested about anything in the project!

Cheers, Adam