Skip to content

Multistage build #62

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

Closed
wants to merge 3 commits into from
Closed

Multistage build #62

wants to merge 3 commits into from

Conversation

flavioaiello
Copy link

With multi-stage builds, multiple FROM statements can be used to separate source- and runtime-build. The resulting docker image is very small and does not contain obsolete libs, thus reducing the potential attack surface.
Haproxy as a very mature and leading docker image was setup many years ago. This pull request should initiate the switch to multistage build.

@tianon
Copy link
Member

tianon commented Mar 21, 2018

I'm definitely not seeing size savings from this; the current build of haproxy:1.8-alpine is ~16.8MB, and this build clocks in at ~21MB.

See also docker-library/official-images#3383.

@tianon
Copy link
Member

tianon commented Mar 21, 2018

I've gotten it a little better by removing the Alpine haproxy package and not doing apk update or apk upgrade, but it's still ~17.7MB and doesn't run properly (because it's missing at least libpcre.so.1, possibly other libraries too).

@flavioaiello
Copy link
Author

I tought libpcre is only needed during build- and not on runtime. I pushed an update removing the haproxy apk package and the update/upgrade step. Imho using multistage-build increases usability.

@yosifkit
Copy link
Member

We cannot use multi-stage builds at this time: docker-library/official-images#3383.

@yosifkit yosifkit closed this Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants