From: 오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 Date: Tue, 8 Oct 2019 07:44:19 +0000 (+0900) Subject: [cmd] Docker image build command (#7981) X-Git-Tag: submit/tizen/20191205.083104~912 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01c5fe9e37717ffd7c6dc760186890ed2b7c5bc7;p=platform%2Fcore%2Fml%2Fnnfw.git [cmd] Docker image build command (#7981) Add argument in build docker image command for additional dockerfile - ubuntu 18.04 Signed-off-by: Hyeongseok Oh --- diff --git a/infra/command/build-docker-image b/infra/command/build-docker-image index 12f622d..7653a0c 100644 --- a/infra/command/build-docker-image +++ b/infra/command/build-docker-image @@ -4,40 +4,46 @@ 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="infra/docker/Dockerfile" +DOCKER_FILE_RPATH_BASE="infra/docker/Dockerfile" DOCKER_BUILD_ARGS=() +DOCKER_FILE_RPATH=${DOCKER_FILE_RPATH_BASE} +DOCKER_IMAGE_NAME=${DOCKER_IMAGE_NAME:-nnas} -# Handle argument for this script -# Set default docker image name, tag -for i in "$@" +while [[ $# -gt 0 ]] do - case ${i} in + arg="$1" + # Handle argument for this script + # Set default docker image name, tag + case $arg in -h|--help|help) Usage exit 1 ;; - esac -done - -DOCKER_BUILD_ARGS+="-t ${DOCKER_IMAGE_NAME:-nnas}" - -# Argument for docker build commands -for i in "$@" -do - case ${i} in - -h|--help|help) - # Already handled argument + --extension) + DOCKER_FILE_RPATH="${DOCKER_FILE_RPATH_BASE}.$2" + shift + shift + ;; + -t|--tag) + DOCKER_IMAGE_NAME="$2" + shift + shift ;; *) - DOCKER_BUILD_ARGS+=(${i}) + 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[@]} \