diff options
author | Damien Martin-Guillerez <dmarting@google.com> | 2016-03-01 15:11:08 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2016-03-01 19:13:34 +0000 |
commit | fc7797954072a7a8c02652ef15a06e9efd738865 (patch) | |
tree | 7a5ea8a294ca745499f3a20ce188cfbfc6d69e0b /tools | |
parent | 49c1364770e750734f7aff1f6469e10776687d60 (diff) |
Docker: fix runfiles path when the incremental loader is called from another Bazel binary.
Also add the possibility to select the docker binary using an environment
variable.
--
MOS_MIGRATED_REVID=115994650
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build_defs/docker/incremental_load.sh.tpl | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tools/build_defs/docker/incremental_load.sh.tpl b/tools/build_defs/docker/incremental_load.sh.tpl index 7217fccd77..2db031d478 100644 --- a/tools/build_defs/docker/incremental_load.sh.tpl +++ b/tools/build_defs/docker/incremental_load.sh.tpl @@ -14,13 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This is a generated files that load all docker layer built by "docker_build". +# This is a generated files that loads all docker layer built by "docker_build". -RUNFILES=${BASH_SOURCE[0]}.runfiles +RUNFILES="${PYTHON_RUNFILES:-${BASH_SOURCE[0]}.runfiles}" + +DOCKER="${DOCKER:-docker}" # List all images identifier (only the identifier) from the local # docker registry. -IMAGES="$(docker images -aq)" +IMAGES="$("${DOCKER}" images -aq)" IMAGE_LEN=$(for i in $IMAGES; do echo -n $i | wc -c; done | sort -g | head -1 | xargs) [ -n "$IMAGE_LEN" ] || IMAGE_LEN=64 @@ -33,7 +35,7 @@ function incr_load() { echo "Skipping $name, already loaded." else echo "Loading $name..." - docker load -i ${RUNFILES}/$2 + "${DOCKER}" load -i ${RUNFILES}/$2 fi } @@ -45,5 +47,5 @@ function incr_load() { if [ -n "${name}" ]; then TAG="${1:-%{repository}:%{tag}}" echo "Tagging ${name} as ${TAG}" - docker tag -f ${name} ${TAG} + "${DOCKER}" tag -f ${name} ${TAG} fi |