rules_docker icon indicating copy to clipboard operation
rules_docker copied to clipboard

Add `extra_deps` attribute to `container_run_and_commit`*

Open dpward opened this issue 3 years ago • 6 comments

#1003 (with a follow-up fix in #1933) added an extra_deps attribute to container_run_and_extract:

https://github.com/bazelbuild/rules_docker/blob/1bb136eb4661624eb8ac1e607cdf74369987b46d/docker/util/run.bzl#L58-L61

The attribute is needed by container_run_and_commit and container_run_and_commit_layer for exactly the same reason.

dpward avatar Sep 19 '22 03:09 dpward

Is it not possible to chain together container_run_and_commit_layer and container_image?

For example

container_image(
  name = "stage_1",
  tars = [
    ":app",
  ],
)

container_run_and_commit_layer(
  name = "stage_2",
  image = ":stage_1.tar",
  commands = [ "setup.sh" ],
)

njlr avatar Nov 03 '22 17:11 njlr

Assume that setup.sh requires a file to be mounted in the container (i.e. with docker -v). The dependency which generates that file should be specified directly in container_run_and_commit_layer.

It can be expensive to run container_image. We don't need to call it for the sole purpose of making sure a dependency is satisfied for an independent rule. (Consider that the container image may already exist.)

dpward avatar Nov 03 '22 18:11 dpward

FYI https://github.com/bazelbuild/rules_docker/pull/2209

manuelnaranjo avatar Jan 11 '23 14:01 manuelnaranjo

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

github-actions[bot] avatar Jul 11 '23 02:07 github-actions[bot]

/remove-labels "Can Close?"

dpward avatar Jul 11 '23 16:07 dpward