Skip to content

Commit

Permalink
Removed directories that were pointless in this pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
andyneff committed Jul 31, 2015
1 parent 796ec71 commit 3207b46
Show file tree
Hide file tree
Showing 15 changed files with 8 additions and 21 deletions.
19 changes: 5 additions & 14 deletions docker/build_dockers.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,18 @@ CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
: ${SUDO=`if ( [ ! -w /var/run/docker.sock ] && id -nG | grep -qwv docker && [ "${DOCKER_HOST:+dh}" != "dh" ] ) && which sudo > /dev/null 2>&1; then echo sudo; fi`}

if [[ $# == 0 ]]; then
IMAGE_DIRS=($(ls -d ${CUR_DIR}/git-lfs_*/Dockerfile))
IMAGE_NAMES=($(ls -d ${CUR_DIR}/git-lfs_*.dockerfile))
else
IMAGE_DIRS=("${@}")
IMAGE_NAMES=("${@}")
fi

#Strip the Dockerfile (When appropriate)
for i in "${!IMAGE_DIRS[@]}"; do
IMAGE_NAME=$(basename ${IMAGE_DIRS[$i]})
if [ "${IMAGE_NAME,,}" == "dockerfile" ]; then
IMAGE_DIRS[$i]=$(dirname ${IMAGE_DIRS[$i]})
fi
done
unset i IMAGE_NAME

if [ ! -e "${CUR_DIR}/signing.key" ]; then
touch "${CUR_DIR}/signing.key"
fi

#This will take a long time the first time
for IMAGE_DIR in "${IMAGE_DIRS[@]}"; do
echo Docker building ${IMAGE_DIR}
$SUDO docker build -t git-lfs/$(basename ${IMAGE_DIR}) -f ${IMAGE_DIR}/Dockerfile ${CUR_DIR}
for IMAGE_NAME in "${IMAGE_NAMES[@]}"; do
echo Docker building ${IMAGE_NAME}
$SUDO docker build -t git-lfs/$(basename ${IMAGE_NAME%.*}) -f ${IMAGE_NAME} ${CUR_DIR}
done

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 3 additions & 7 deletions docker/run_dockers.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ PACKAGE_DIR=${REPO_DIR}/repos
: ${SUDO=`if ( [ ! -w /var/run/docker.sock ] && id -nG | grep -qwv docker && [ "${DOCKER_HOST:+dh}" != "dh" ] ) && which sudo > /dev/null 2>&1; then echo sudo; fi`}

function split_image_name()
{ #$1 - image directory name or dockerfile
{ #$1 - image dockerfile
#sets IMAGE_NAME to the basename of the dir containing the docker file
#sets IMAGE_INFO to be the array name following my pattern
IMAGE_NAME=$(basename $1)
if [ "${IMAGE_NAME,,}" == "dockerfile" ]; then
IMAGE_NAME=$(basename $(dirname $1))
fi

IMAGE_NAME=$(basename ${1%.*})
local IFS=_
IMAGE_INFO=(${IMAGE_NAME})
}
Expand All @@ -55,7 +51,7 @@ while [[ $# > 0 ]]; do
done

if [[ ${#IMAGES[@]} == 0 ]]; then
IMAGES=($(ls -d ${CUR_DIR}/git-lfs_*/Dockerfile))
IMAGES=($(ls -d ${CUR_DIR}/git-lfs_*.dockerfile))
fi

mkdir -p "${PACKAGE_DIR}"
Expand Down

0 comments on commit 3207b46

Please sign in to comment.