I have a large docker image (several GBs). There is BUILD file:
container_image(
name = "latest",
base = "@large_image//image",
files = ["test.conf"],
)
If I change only test.conf (or even don't change anything) bazel run is always load image.
who:docker alex$ time bazel run //:latest ; time bazel run //:latest
(21:53:19) INFO: Current date is 2018-02-01
(21:53:19) Loading:
(21:53:19) Loading: 0 packages loaded
(21:53:19) INFO: Analysed target //:latest (0 packages loaded).
(21:53:19) INFO: Found 1 target...
(21:53:19) [0 / 1] [-----] BazelWorkspaceStatusAction stable-status.txt
Target //:latest up-to-date:
bazel-bin/latest-layer.tar
(21:53:19) INFO: Elapsed time: 0.232s, Critical Path: 0.01s
(21:53:19) INFO: Build completed successfully, 1 total action
(21:53:19) INFO: Running command line: bazel-bin/latest
Loaded image ID: sha256:a965b927101b41b4619e66a36cf013f434b00324997904d3dafb7b3a11de6c74
Tagging a965b927101b41b4619e66a36cf013f434b00324997904d3dafb7b3a11de6c74 as bazel:latest
real 0m56.434s
user 0m0.097s
sys 0m0.065s
(21:54:16) INFO: Current date is 2018-02-01
(21:54:16) Loading:
(21:54:16) Loading: 0 packages loaded
(21:54:16) INFO: Analysed target //:latest (0 packages loaded).
(21:54:16) INFO: Found 1 target...
(21:54:16) [0 / 1] [-----] BazelWorkspaceStatusAction stable-status.txt
Target //:latest up-to-date:
bazel-bin/latest-layer.tar
(21:54:16) INFO: Elapsed time: 0.258s, Critical Path: 0.01s
(21:54:16) INFO: Build completed successfully, 1 total action
(21:54:16) INFO: Running command line: bazel-bin/latest
Loaded image ID: sha256:a965b927101b41b4619e66a36cf013f434b00324997904d3dafb7b3a11de6c74
Tagging a965b927101b41b4619e66a36cf013f434b00324997904d3dafb7b3a11de6c74 as bazel:latest
real 0m56.111s
user 0m0.097s
sys 0m0.070s
I expect that only changed layers should be loaded.
How is @large_image defined? What version of rules_docker are you on?
@mattmoor here's my WORKSPACE:
git_repository(name = "io_bazel_rules_docker", remote = "https://github.com/bazelbuild/rules_docker.git", tag = "v0.3.0",)
load("@io_bazel_rules_docker//container:container.bzl", "container_pull", container_repositories = "repositories",)
container_repositories()
container_pull(
name = "large_image",
registry = "internal-registry",
repository = "docker/image",
tag = "latest",
)
Can you try @ HEAD vs. v0.3.0?
I'm really bad about cutting releases (sorry!)
Much better! 6s instead of 56s
Awesome!
I'm going to close in favor of https://github.com/bazelbuild/rules_docker/issues/303 and see if I can initiate someone into the art of cutting a release, so I'm not solely to blame for these kinds of problems :)
Most helpful comment
Much better! 6s instead of 56s