build-docker: make docker command configurable via env

This commit is contained in:
Oleksii Shevchuk 2020-03-01 21:38:52 +02:00
parent 197701ef7b
commit 45c4f61c0d
1 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@ SELF=`readlink -f "$0"`
PUPY=`dirname "$SELF"`/../
PUPY=`readlink -f "$PUPY"`
DOCKER_COMMAND=${DOCKER_COMMAND:-docker}
DOCKER_REPO=${DOCKER_REPO:-"alxchk"}
CLEAN=${CLEAN:-"no"}
@ -31,17 +32,17 @@ start_container() {
echo
echo "[+] Build $SOURCES with toolchain ${REPO}$TOOLCHAIN"
NEW=""
docker container inspect ${CONTAINER_NAME} >/dev/null 2>/dev/null || NEW=1
${DOCKER_COMMAND} container inspect ${CONTAINER_NAME} >/dev/null 2>/dev/null || NEW=1
if [ ! -z "$NEW" ]; then
mkdir -p /tmp/pupy-build/${REPO}${TOOLCHAIN}
docker run --name ${CONTAINER_NAME} \
${DOCKER_COMMAND} run --name ${CONTAINER_NAME} \
-v ${PUPY}:/build/workspace/project ${REPO}${TOOLCHAIN} ${SCRIPT}
else
docker start -ai ${CONTAINER_NAME}
${DOCKER_COMMAND} start -ai ${CONTAINER_NAME}
fi
if [ "$CLEAN" == "yes" ]; then
docker rm ${CONTAINER_NAME}
${DOCKER_COMMAND} rm ${CONTAINER_NAME}
fi
echo
)