tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tqc...@apache.org
Subject [incubator-tvm] branch master updated: Create a new parameter --cache-from in tvm/docker/build.sh, so that we can point to an image to be used as cache, from an external (#5173)
Date Mon, 30 Mar 2020 15:28:47 GMT
This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new 079e184  Create a new parameter --cache-from in tvm/docker/build.sh, so that we can
point to an image to be used as cache, from an external (#5173)
079e184 is described below

commit 079e18449dbb4047e3bbe9399a436a233669d432
Author: Leandro Nunes <leandro.nunes@arm.com>
AuthorDate: Mon Mar 30 16:28:41 2020 +0100

    Create a new parameter --cache-from in tvm/docker/build.sh, so that we can point to an
image to be used as cache, from an external (#5173)
    
    script.
    
     * Adjusts documentation to provide information about new optional
       parameter "--cache-from"
     * Includes --cache-from in the underlying "docker build" command
       triggered by build.sh, when required
---
 docker/build.sh | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/docker/build.sh b/docker/build.sh
index 21141b7..5bbb143 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -21,7 +21,7 @@
 # Execute command within a docker container
 #
 # Usage: build.sh <CONTAINER_TYPE> [--dockerfile <DOCKERFILE_PATH>] [-it]
-#                    <COMMAND>
+#                [--net=host] [--cache-from <IMAGE_NAME>] <COMMAND>
 #
 # CONTAINER_TYPE: Type of the docker container used the run the build: e.g.,
 #                 (cpu | gpu)
@@ -30,6 +30,9 @@
 #                  this optional value is not supplied (via the --dockerfile
 #                  flag), will use Dockerfile.CONTAINER_TYPE in default
 #
+# IMAGE_NAME: An image to be as a source for cached layers when building the
+#             Docker image requested.
+#
 # COMMAND: Command to be executed in the docker container
 #
 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -60,6 +63,13 @@ if [[ "$1" == "--net=host" ]]; then
     shift 1
 fi
 
+if [[ "$1" == "--cache-from" ]]; then
+    shift 1
+    cached_image="$1"
+    CI_DOCKER_BUILD_EXTRA_PARAMS+=("--cache-from $cached_image")
+    shift 1
+fi
+
 if [[ ! -f "${DOCKERFILE_PATH}" ]]; then
     echo "Invalid Dockerfile path: \"${DOCKERFILE_PATH}\""
     exit 1
@@ -126,7 +136,9 @@ echo ""
 # Build the docker container.
 echo "Building container (${DOCKER_IMG_NAME})..."
 docker build -t ${DOCKER_IMG_NAME} \
-    -f "${DOCKERFILE_PATH}" "${DOCKER_CONTEXT_PATH}"
+    -f "${DOCKERFILE_PATH}" \
+    ${CI_DOCKER_BUILD_EXTRA_PARAMS[@]} \
+    "${DOCKER_CONTEXT_PATH}"
 
 # Check docker build status
 if [[ $? != "0" ]]; then


Mime
View raw message