X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=tools%2Fbuild-with-docker;h=a7f6cfab4588ab8c895dd63989f4085d08c4eae4;hb=ac1f04d47846385a239ef96a12bc7c80de4310db;hp=e0227acab677f4fdc6eed0f687e9b012414defe3;hpb=bd64a436427ec210c909afa372fcbb4af87edaf3;p=anna.git diff --git a/tools/build-with-docker b/tools/build-with-docker index e0227ac..a7f6cfa 100755 --- a/tools/build-with-docker +++ b/tools/build-with-docker @@ -7,40 +7,26 @@ REPO_DIR="$(git rev-parse --show-toplevel 2>/dev/null)" [ -z "$REPO_DIR" ] && { echo "You must execute under a valid git repository !" ; exit 1 ; } -############# -# FUNCTIONS # -############# - -# $1: image directory -build_image() { - local imgdir=$1 - - local imgname=$(basename ${imgdir}) - local imgtag=${TAG} - - echo "Building ${imgname}:${imgtag} ..." - cd ${imgdir} - - # Dockerfile for other contexts: - local dck_opt= - local preferred=Dockerfile.$(arch) - [ -f ${preferred} ] && { dck_opt="-f ${preferred}" ; echo "Selected '${preferred}' for current architecture." ; } - [ -z "${dck_opt}" -a ! -f Dockerfile ] && { echo "No Dockerfile for this directory. Ignoring ..." ; cd - >/dev/null ; return 1 ; } - - docker build -t ${imgname}:${imgtag} ${dck_opt} . - [ $? -ne 0 ] && { echo "An error ocurred. Aborting ..." ; cd - >/dev/null ; return 1 ; } - cd - >/dev/null -} +VARIANT=${1:-Release} +ENVS="-e VARIANT=${VARIANT}" ############# # EXECUTION # ############# +echo +echo "Variant: ${VARIANT}" +echo "Remember usage: $0 [variant: <[Release]|Debug]>" +echo + TAG=$(${REPO_DIR}/tools/version) +# Docker build functions +source ${REPO_DIR}/tools/docker.src + # Build compilation image: -build_image ${REPO_DIR}/docker-images/anna-build-nodb # this image has neither oracle nor mysql installed +build_image ${REPO_DIR}/docker-images/anna-build-nodb ${TAG} # this image has neither oracle nor mysql installed # Build source with previous compilation image: -docker run --rm -it -u $(id -u):$(id -g) -v ${REPO_DIR}:/code -w /code anna-build-nodb:${TAG} +docker run --rm -it -u $(id -u):$(id -g) ${ENVS} -v ${REPO_DIR}:/code -w /code anna-build-nodb:${TAG}