-
Notifications
You must be signed in to change notification settings - Fork 612
Optimize Docker image #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Remove and unpack TAR file in the same layer as the download * Clean up more leftovers from installing curl * Add .dockerignore to minimize build context to necessary files
The advantage of having it as "entrypoint", is that the whole image can be used as it it was the 'docker-gen', so Two thoughts to get the image-size down even further (and/or simplify the Dockerfile);
|
I just consider this the low-hanging fruit based on the current Dockerfile. It would be interesting to play around with getting a really small image based on |
@thaJeztah do you know how they're building the |
@md5 I'm 👍 on the changes in this PR, but it got me thinking if more awesomeness was possible
Hm, I think I saw it pass on IRC when it was first added to the official library. I can try and find the logs (in #docker-library), or you can ask "aluzzardi" (left out the |
@md5 oh, think I found it; docker-library/official-images#440 (comment) edit; hm, not sure that gives all the info though |
@thaJeztah I remember following that discussion, but as you say it doesn't say how they're actually building After a bit of Googling, I found a few blog posts (e.g. this one) about how to create statically compiled Go binaries and created this: appropriate@dd66573 This was the result:
I haven't had a chance to play around with it yet and probably won't get to today. |
💯 Oh, that's looking awesome! I'll see if I can find some time to test it as well (but it's quite hectic at work atm, so no promises) Are there known use-cases of people building on top of the docker-gen image? If that's the case, I can imagine offering both variations (debian + docker-gen and only "bare" docker-gen). If not, making this the default does look good. |
I don't know of anyone building on top of the I did get a minute to test this and it appears to work fine (see the tip of the
I checked the output and it looks as it should. |
I just did a quick search for people making images There's at least one result from the first page: https://github.com/nuclyus/docker-juhasz |
I took a closer look at how Docker Swarm is building their binary and it looks like they actually do it in the I've made a couple changes to the |
Apparently the |
^^ just read the discussion there, talk about bad UX 😞 |
Ping @jwilder |
I ended up looking at the Dockerfile for docker-gen after seeing this comment: #50 (comment)
I made the following improvements to help speed up and optimize the Docker image build:
I actually think that the
ENTRYPOINT
should be changed to aCMD
too, but that would be a breaking change for some users and I didn't include it.