diff options
author | James Conroy <james.conroy@arm.com> | 2022-08-04 16:55:05 +0100 |
---|---|---|
committer | Nikhil Raj <nikhil.raj@arm.com> | 2022-08-05 16:33:41 +0100 |
commit | 210897d7afb4007fe06d390c2ec333a732390b5c (patch) | |
tree | fc172104328e511c3c262135f40cba0f25a96068 /build-tool/scripts/docker-copy-to-host.sh | |
parent | dba6773af86ac3f79171503fd3b48b0bd1618239 (diff) | |
download | armnn-210897d7afb4007fe06d390c2ec333a732390b5c.tar.gz |
IVGCVSW-6777 Add Arm NN build-tool Dockerfile
* Adds Dockerfile associated with Arm NN build-tool scripts.
* The Dockerfile encapsulates the installation of system-wide
packages (install-packages.sh), download/install of Arm NN
dependencies (setup-armnn.sh) and the building of Arm NN
and ACL (build-armnn.sh).
* A helper script for copying build contents from the built
Docker image is provided for by docker-copy-to-host.sh.
* Modified existing scripts: moved the cloning of Arm NN and
ACL from setup-armnn.sh to build-armnn.sh and decoupled
setup-armnn.sh from scripts outside of build-tool directory
e.g. armnn/scripts/get_tensorflow.sh.
* The build-armnn.sh script clones the latest release branches
of Arm NN and ACL by default. Custom repos can be placed in
the build-tool directory prior to 'docker build' and they
will be used instead (advanced usage).
* Support added for Linux targets only, Android to be added
in future work.
Signed-off-by: James Conroy <james.conroy@arm.com>
Change-Id: I336013cf93821d2cd3e5d9fe2ca4e955ffdd2386
Diffstat (limited to 'build-tool/scripts/docker-copy-to-host.sh')
-rwxr-xr-x | build-tool/scripts/docker-copy-to-host.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/build-tool/scripts/docker-copy-to-host.sh b/build-tool/scripts/docker-copy-to-host.sh new file mode 100755 index 0000000000..bb120462e5 --- /dev/null +++ b/build-tool/scripts/docker-copy-to-host.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Copyright © 2022 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +# Script which copies a file or directory from the /home/arm-user/ directory in Docker to the host machine +# This script creates a directory called 'docker_output' in the current directory and places the copied contents there +# Takes two arguments: +# 1. Name of created Docker image i.e. "--tag <name:tag>" provided at 'docker build' stage (tag is optional in image naming) +# 2. Relative path to file or directory to copy from the Docker /home/arm-user/ directory +# +# Examples: +# 1. Copy the tarball of the aarch64 build from the /home/arm-user/ directory +# ./scripts/docker-copy-to-host.sh armnn_image armnn_aarch64_build.tar.gz +# 2. Copy the unarchived Arm NN build +# ./scripts/docker-copy-to-host.sh armnn_image build/armnn +# 3. Copy the unarchived ACL build +# ./scripts/docker-copy-to-host.sh armnn_image build/acl + +set -o nounset # Catch references to undefined variables. +set -o pipefail # Catch non zero exit codes within pipelines. +set -o errexit # Catch and propagate non zero exit codes. + +image_name="$1" +file_path="$2" + +name=$(basename "$0") + +echo "***** $name: Copying file(s) from path /home/arm-user/$file_path inside Docker image '$image_name' to host *****" + +echo -e "\n***** Creating directory docker_output on host *****" +mkdir -p docker_output + +# Cleanup old 'armnn_temp' container in case a previous run of this script was not successful +docker rm --force armnn_temp 2> /dev/null + +echo -e "\n***** Creating temporary Docker container named armnn_temp using Docker image '$image_name' *****" +docker create --interactive --tty --name armnn_temp "$image_name" bash > /dev/null + +echo -e "\n***** Running Docker command: docker cp armnn_temp:/home/arm-user/$file_path ./docker_output *****" +docker cp armnn_temp:/home/arm-user/"$file_path" ./docker_output > /dev/null + +echo -e "\n***** Successfully copied file(s) to host in directory docker_output *****" + +# Remove temporary docker container 'armnn_temp' +docker rm --force armnn_temp > /dev/null + +echo -e "\n***** Deleted temporary Docker container armnn_temp *****"
\ No newline at end of file |