CMD="export TARGET_ARCH=armv7l && export CROSS_BUILD=1 && make acl && make && make install"
docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME sh -c "$CMD"
+BUILD_RESULT=$?
+
+# Newly created files during above docker run can have different ownership.
+# This may cause some problems, for example, some jenkins slaves or developers
+# can't remove built files due to lack of permission.
+# To address this issue, let's change owner of all files
+# in NNFW to owner of NNFW.
+NNFW_OWNER_UID=$(stat -c "%u" $HOST_HOME)
+NNFW_OWNER_GID=$(stat -c "%g" $HOST_HOME)
+
+CMD="chown -R $NNFW_OWNER_UID:$NNFW_OWNER_GID $DOCKER_HOME"
+docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
+
+exit $BUILD_RESULT
mkdir -p $TMP_DIR/libarmcl
# prepare armcl library
-wget http://npuarchive.mooo.com/archive/nnfw/libarmcl/libarmcl.tar.gz -O $TMP_DIR/libarmcl.tar.gz
+wget http://npuarchive.mooo.com/archive/nnfw/libarmcl/libarmcl.tar.gz -O $TMP_DIR/libarmcl.tar.gz -nv
tar -zxvf $TMP_DIR/libarmcl.tar.gz -C $TMP_DIR/libarmcl
# prepare rootfs
-wget http://npuarchive.mooo.com/archive/nnfw/rootfs/rootfs_arm_ubuntu.tar.gz -O $TMP_DIR/rootfs.tar.gz
+wget http://npuarchive.mooo.com/archive/nnfw/rootfs/rootfs_arm_ubuntu.tar.gz -O $TMP_DIR/rootfs.tar.gz -nv
tar -zxf $TMP_DIR/rootfs.tar.gz -C $TMP_DIR
DOCKER_VOLUMES+=" -v $TMP_DIR/arm:/opt/rootfs"
docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME sh -c "$CMD"
BUILD_RESULT=$?
+# Newly created files during above docker run can have different ownership.
+# This may cause some problems, for example, some jenkins slaves or developers
+# can't remove built files due to lack of permission.
+# To address this issue, let's change owner of all files
+# in NNFW to owner of NNFW.
+NNFW_OWNER_UID=$(stat -c "%u" $HOST_HOME)
+NNFw_OWNER_GID=$(stat -c "%g" $HOST_HOME)
+
+CMD="chown -R $NNFW_OWNER_UID:$NNFW_OWNER_GID $DOCKER_HOME"
+docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
+
rm -rf $TMP_DIR
exit $BUILD_RESULT