Skip to content
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

Use a multi-stage Dockerfile to have slimmer image #217

Merged
merged 1 commit into from
Mar 28, 2018

Conversation

DrMurx
Copy link

@DrMurx DrMurx commented Mar 13, 2018

This PR improves the docker image by using a multistage Dockerfile. This allows to keep build-time dependencies in a dedicated container.

The previous implementation just deleted the build tools, but due to docker's layering schema they were still hidden in lower layers, leading to a unnecessary big image (729MB).

The actual image of the final build stage is based on a plain alpine:3.7 and is only 36MB.


RUN rm -rf /go/src /go/pkg && apk --no-cache del make git musl-dev
RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
#RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you have commented this, is there a particular reason for doing it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a relic. I wasn't sure whether it's still needed. Turned out it's apparently not.

I've removed the line.

@DrMurx DrMurx force-pushed the slimmer_docker_image branch from b35444a to 2c3f8a1 Compare March 14, 2018 09:52
DrMurx pushed a commit to erasys/mariadb-ha-test that referenced this pull request Mar 16, 2018
While signal18/replication-manager#217 is open, provide
a dedicated build context for a smaller image
@tanji tanji merged commit 7f14fae into signal18:2.0 Mar 28, 2018
@tanji
Copy link
Collaborator

tanji commented Mar 28, 2018

OK. Sorry for the late reply (was on vacations). The image works great even without the symbolic link. Therefore I am merging this PR. Thanks for the contribution!

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.

2 participants