From caa3e242bdd43bef549360e7e8baf6a7e9365de9 Mon Sep 17 00:00:00 2001 From: pvizeli Date: Wed, 15 Mar 2017 08:49:10 +0100 Subject: [PATCH] update script p2 --- .../yocto-build-env/create_build_env.sh | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 build-scripts/yocto-build-env/create_build_env.sh diff --git a/build-scripts/yocto-build-env/create_build_env.sh b/build-scripts/yocto-build-env/create_build_env.sh new file mode 100644 index 000000000..37ae2d581 --- /dev/null +++ b/build-scripts/yocto-build-env/create_build_env.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -ev + +DOCKER_REPO=pvizeli +DOCKER_IMAGE=yocto-build-env + +# Get the absolute script location +pushd `dirname $0` > /dev/null 2>&1 +SCRIPTPATH=`pwd` +popd > /dev/null 2>&1 + +# Sanity checks +if [ "$#" -ne 1 ]; then + echo "Usage: create_build_env.sh [ | NONE]" + exit 1 +fi + +REVISION=$1 + +# Build +docker build --pull --tag ${DOCKER_REPO}/${DOCKER_IMAGE}:${REVISION} -f ${SCRIPTPATH}/Dockerfile ${SCRIPTPATH} + +# Tag +docker tag ${DOCKER_REPO}/${DOCKER_IMAGE}:${REVISION} ${DOCKER_REPO}/${DOCKER_IMAGE}:latest + +if [${REVISION} -ne "NONE"]; then + # push + docker push ${DOCKER_REPO}/${DOCKER_IMAGE}:${REVISION} + docker push ${DOCKER_REPO}/${DOCKER_IMAGE}:latest +fi