-
-
Notifications
You must be signed in to change notification settings - Fork 22
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 (and build time) #115
Conversation
This swaps the base image so that we can have: * faster builds * smaller images * more secure and up-to-date dependencies Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
It's recommended to use `COPY` instead of `ADD` because it's much simpler and avoids unexpected behaviour - `ADD` can also do things like uncompressing files and remote requests. More info: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#add-or-copy Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
We can compare the speed improvements on the build too: a previous run took 1m31s while this one took 41s. |
I just noticed that we don't have the branch |
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.
LGTM! I just need to do the branching ballet to get this released then :-)
We only need to dump the autoloader at this stage, so it's unnecessary to do anything beyond that. Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
BuildKit is an optimised builder for docker. Although it isn't enabled by default, it helps to speed up the process even more and it's quite stable at this point. More info: https://docs.docker.com/develop/develop-images/build_enhancements/ Signed-off-by: Luís Cobucci <lcobucci@gmail.com>
3aba155
to
144704b
Compare
@@ -18,4 +18,4 @@ jobs: | |||
uses: "actions/checkout@v2" | |||
|
|||
- name: "Docker Build" | |||
run: "docker build ." | |||
run: "DOCKER_BUILDKIT=1 docker build ." |
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.
BUILDKIT FTW 💪
Branching fixed: 🚢 |
Thanks @Ocramius |
I CANNOT WAIT for my next release to see the speed improvements! |
Description
This improves the build process of the docker image.
When the base images are already downloaded, it takes about 15s to build the image using BuildKit - previously it was taking 1m19s.
The image size has also been drastically reduced, it's 122Mb - previously was 390Mb.