Commit c1f717f
committed
[Dockerfile] Faster runs after local changes
This segments the portions of the `docker build` from ones that are more
likely in between project file changes between test runs and ones that
don't to reduce the re-build time when running tests via docker
Context
-------
So when you first run `rake test:docker:all` on a fresh install, you
should expect this to take a bit since the docker cache isn't warmed and
the steps of the image build process need to download items. You
probably can expect this to take the sum total of about 10ish minutes
the first time around.
Some of this will be shared between versions of ruby (apt packages,
installing `rvm`, etc.), but once you start installing specific versions
of ruby, they images will diverge.
That said, once you have gone through the build, subsequent runs with no
changes take only about 10 seconds:
$ rake test:docker
...
real 0m10.660s
user 0m0.819s
sys 0m0.422s
However, prior to this change, any file change made in the project dir
required rebuilding everything installing bundler on. This ended up
increasing the time to about a minute:
$ rake test:docker
...
real 1m10.171s
user 0m0.668s
sys 0m0.392s
Changes
-------
With this change, we push the bundling to happen in a separate directory
from the final working dir, and only include the files necessary to
perform that action. This decreases the time it takes to run the entire
suite across all versions by 40 seconds:
$ rake test:docker
...
real 0m26.009s
user 0m0.858s
sys 0m0.464s
We could further improve this by segmenting out the `rake build` steps,
but for now I think this is an acceptable speed for most, and that is a
slightly more complicated process to make that happen. Doing so would
require not only moving the files we need just to compile done
separately, but also moving the rest of the files that aren't involved
with the C-extension separately.1 parent fd4d447 commit c1f717f
1 file changed
+11
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments