diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2020-03-04 18:09:24 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2020-03-04 18:09:24 +0900 |
commit | 302e6564a7a76109e1178207e44e45a58631c477 (patch) | |
tree | 6cc4bd95e5e438331fc2c53234af4ed0e0f3bc20 /infra/command/build-docker-image | |
parent | bd11b24234d7d43dfe05a81c520aa01ffad06e42 (diff) | |
download | nnfw-302e6564a7a76109e1178207e44e45a58631c477.tar.gz nnfw-302e6564a7a76109e1178207e44e45a58631c477.tar.bz2 nnfw-302e6564a7a76109e1178207e44e45a58631c477.zip |
Imported Upstream version 1.1.0upstream/1.1.0submit/tizen/20200304.094649submit/tizen/20200304.093946submit/tizen/20200304.092919accepted/tizen/unified/20200305.051107
Diffstat (limited to 'infra/command/build-docker-image')
-rw-r--r-- | infra/command/build-docker-image | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/infra/command/build-docker-image b/infra/command/build-docker-image new file mode 100644 index 000000000..7653a0c88 --- /dev/null +++ b/infra/command/build-docker-image @@ -0,0 +1,50 @@ +#!/bin/bash + +function Usage() +{ + echo "Usage: $0 $(basename ${BASH_SOURCE[0]}) [OPTIONS]" + echo "" + echo "Options:" + echo " --extension dockerfile extension in infra/docker" + echo "Options can use as docker build option:" + docker build --help +} + +DOCKER_FILE_RPATH_BASE="infra/docker/Dockerfile" +DOCKER_BUILD_ARGS=() +DOCKER_FILE_RPATH=${DOCKER_FILE_RPATH_BASE} +DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME:-nnas} + +while [[ $# -gt 0 ]] +do + arg="$1" + # Handle argument for this script + # Set default docker image name, tag + case $arg in + -h|--help|help) + Usage + exit 1 + ;; + --extension) + DOCKER_FILE_RPATH="${DOCKER_FILE_RPATH_BASE}.$2" + shift + shift + ;; + -t|--tag) + DOCKER_IMAGE_NAME="$2" + shift + shift + ;; + *) + DOCKER_BUILD_ARGS+=(${1}) + shift + ;; + esac +done + +DOCKER_BUILD_ARGS+=("-t ${DOCKER_IMAGE_NAME}") + +docker build --build-arg http_proxy="${http_proxy}" \ + --build-arg https_proxy="${https_proxy}" \ + ${DOCKER_BUILD_ARGS[@]} \ + - < ${NNAS_PROJECT_PATH}/${DOCKER_FILE_RPATH} |