-
Notifications
You must be signed in to change notification settings - Fork 97
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
Reduce Docker image size from 165 MB to 32.8 MB #131
Conversation
Using multi-stage build available from Docker 17.05 to avoid having any build artifacts.
Also I noticed that the version referenced in |
From 114 to 32 MB
I tried another approach were the final size is 36 MB, but I'm not sure if it runs correctly. I have modified I then untar the release tar.gz in Do you think it can work like this? |
Thank you so much for the PR! I will pull your branch this weekend and if it's all working well I will release a new version! That's awesome 🎉 |
Dockerfile
Outdated
@@ -13,7 +13,18 @@ RUN mix deps.get | |||
RUN mix compile | |||
RUN echo "" > config/poxa.prod.conf | |||
RUN mix release | |||
RUN mkdir -p /app/$APP_NAME | |||
WORKDIR /app/$APP_NAME | |||
RUN tar xzf /source/_build/prod/rel/$APP_NAME/releases/0.7.1/$APP_NAME.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to tar
the rel/*
so that we don't need to hardcode the version here.
I've tested and it's working nicely! I got 32.8MB here 🎉
Good point! I replaced I'm glad it works :-) I took inspiration from this elixir-forum thread and especially this comment but I was not sure that omitting Should I stash the commits? |
@cbliard, thank you so much! I will release a new version soon! 👌 The commits are ok! I can squash & merge no problem 👍 |
Perfect! Happy to help :-) Thanks for providing poxa 👍 |
Awesome! I will do some manual testing later today or tomorrow and release a brand new version. Thanks once again 👍 |
Great 🎉 I'm waiting for the v0.x.x docker image release :-) |
0.8.0 is out! I also updated the heroku deployment! Thanks again! |
👍 |
I recently upgraded from the old
edgurgelpoxa:0.5.0
docker image to the latestedgurgel:poxa-automated:0.7.2
docker image, and the image size grew from 26 MB to 165 MB.I tried to reduce the size by using multi-stage build available from Docker 17.05 to avoid having any
build artifacts at all and no git package installed. I managed to get a 114 MB image.
I also used
apk --no-cache
instead ofapk --update .... && rm -rf /var/cache/apk/*
.I do not know Erlang/Elixir well enough to go further but at least it's 50 MB less.