repertory/scripts/run_docker_shell.sh
Scott E. Graves 99533a9687
All checks were successful
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
revert
2024-01-29 11:36:26 -06:00

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
NUM_JOBS=${MY_NUM_JOBS}
if [[ -z "${NUM_JOBS}" ]]; then
NUM_JOBS=$(getconf _NPROCESSORS_ONLN 2> /dev/null || getconf NPROCESSORS_ONLN 2> /dev/null || echo 1)
if [ "${NUM_JOBS}" -gt "2" ]; then
NUM_JOBS=$(expr ${NUM_JOBS} - 2)
elif [ "${NUM_JOBS}" -gt "1" ]; then
NUM_JOBS=$(expr ${NUM_JOBS} - 1)
fi
fi
pushd "$(dirname "$0")"
CURRENT_DIR=$(pwd)
pushd "${CURRENT_DIR}/.."
NAME=$1
TYPE=$2
if [ -z "$NAME" ]; then
echo "Name not set"
else
if [ -z "${TYPE}" ]; then
TYPE=64_bit
fi
TAG=repertory_shell
CONTAINER=${TAG}_${NAME}
docker stop ${CONTAINER}
docker rm ${CONTAINER}
docker build --build-arg NUM_JOBS=$NUM_JOBS -t ${TAG}:${NAME} - < docker/${TYPE}/${NAME} &&
docker run -itd --device /dev/fuse --cap-add SYS_ADMIN --name ${CONTAINER} -v $(pwd):/mnt ${TAG}:${NAME} &&
# docker run -itd --device /dev/fuse --cap-add SYS_ADMIN --name ${CONTAINER} ${TAG}:${NAME} &&
docker exec -it ${CONTAINER} /bin/bash
docker stop ${CONTAINER}
docker rm ${CONTAINER}
docker system prune -f
fi
popd
popd