-
Notifications
You must be signed in to change notification settings - Fork 83
Optimise docker build #85
base: 2.20.4
Are you sure you want to change the base?
Conversation
The dependencies change less than the files and take longer to build. Moving them earlier in the Dockerfile means that file changes won't force us to reinstall all the dependencies.
Note that Edit: this is valid only when BUILDKIT is enabled, which is not yet the default. |
oh neat, I didn't know about the (upcoming) I can combine the COPY instructions to reduce the number of layers. It reduces the number of layers, which I think helps with size (although I'm not clear on how big an impact this has). |
That would not have any effect on the resulting file inside the container actually, but it would make sense to mark executables as such, as a general rule.
It would not reduce the image size significantly. You spare some space if you avoid of saving intermediate files, that gets deleted or overridden/modified. |
Are you sure about that? I tried with a simple dockerfile: FROM bash
COPY a.txt .
CMD ls -la a.txt Changing the permissions on a.txt seems to work fine > sudo chmod 451 a.txt
> sudo docker run -it (docker build -q .)
-r--r-x--x 1 root root 0 May 6 00:53 a.txt
> sudo chmod 770 a.txt
> sudo docker run -it (docker build -q .)
-rwxrwx--- 1 root root 0 May 6 00:53 a.txt The docs have this to say, buried in the COPY reference, which isn't super clear to me:
|
I might be wrong or confusing with one of the various different build methods. If it works, great :) |
sorry folks, are we waiting on me for something on this? |
This MR restructures the dockerfiles so that it rebuilds fewer things when changing the scripts, resulting in performance improvements:
I started with this one because it's simpler than the geonode one.