Revise docker_build_cross_arm_ubuntu.sh (#3348)
author오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Fri, 26 Oct 2018 00:39:36 +0000 (09:39 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 26 Oct 2018 00:39:36 +0000 (09:39 +0900)
Revise docker_build_cross_arm_ubuntu.sh
- Remove using nnfw_docker file
- Use docker-run and docker-shell command

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
scripts/command/docker_build_cross_arm_ubuntu.sh

index 5da2bd6..925891a 100755 (executable)
@@ -1,44 +1,30 @@
 #!/bin/bash
 
-SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-# DOCKER_HOME and DOCKER_ENV_VARS
-source $SCRIPT_ROOT/nnfw_docker
-
-HOST_HOME=$SCRIPT_ROOT/../..
-
-DOCKER_VOLUMES+=" -v $HOST_HOME:$DOCKER_HOME"
-
 DOCKER_ENV_VARS+=" -e TARGET_ARCH=armv7l"
 DOCKER_ENV_VARS+=" -e CROSS_BUILD=1"
 DOCKER_ENV_VARS+=" -e ROOTFS_DIR=/opt/rootfs"
 
-DOCKER_RUN_OPTS="--rm"
-DOCKER_RUN_OPTS+=" -w $DOCKER_HOME"
-
 # prepare rootfs
 if [[ ! -d $ROOTFS_DIR ]]; then
-    echo "cannot find rootfs"
-    exit 1
-fi
-
-if [[ ! -z $ENV_FILE ]]; then
-    DOCKER_ENV_VARS+=" --env-file ${ENV_FILE} "
+  echo "cannot find rootfs"
+  exit 1
 fi
 
 DOCKER_VOLUMES+=" -v $ROOTFS_DIR:/opt/rootfs"
 
+export DOCKER_ENV_VARS
+export DOCKER_VOLUMES
+
+pushd $NNFW_PROJECT_PATH
+
 if [ -n "$DOCKER_INTERACTIVE" ]; then
-  DOCKER_RUN_OPTS+=" -it"
-  CMD="/bin/bash"
+  source run docker-shell
 else
   CMD="export BENCHMARK_ACL_BUILD=1 && make acl && make && make install && make build_test_suite"
+  source run docker-run bash -c "${CMD}"
 fi
+EXITCODE=$?
 
-docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME sh -c "$CMD"
-BUILD_RESULT=$?
-
-source $SCRIPT_ROOT/../docker_helper
-restore_ownership $HOST_HOME $DOCKER_HOME
+popd
 
-exit $BUILD_RESULT
+exit $EXITCODE