git-lfs/docker/build_dockers.bsh

42 lines
1.4 KiB
Plaintext
Raw Normal View History

2015-07-12 20:49:48 +00:00
#!/usr/bin/env bash
2015-09-10 15:46:33 +00:00
# Usage:
# ./build_dockers.bsh - Build all the compiling docker images
# ./build_dockers.bsh lfs_centos_5 lfs_centos_7 - Build only CentOS 5 & 7 image
#
# Special Environment Variables
2015-09-10 15:46:33 +00:00
# DOCKER_LFS_BUILD_VERSION - tag or sha to build envirnment off of. Important
# in CentOS
2015-07-12 20:49:48 +00:00
set -eu
CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
: ${GOLANG_VERSION:=1.5.1}
export GOLANG_VERSION
#If you are not in docker group and you have sudo, default value is sudo
2015-07-25 01:54:12 +00:00
: ${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`}
export DOCKER_LFS_BUILD_VERSION=${DOCKER_LFS_BUILD_VERSION:-master}
2015-07-26 00:01:11 +00:00
if [[ $# == 0 ]]; then
IMAGE_NAMES=($(ls -d ${CUR_DIR}/git-lfs_*.dockerfile))
else
IMAGE_NAMES=("${@}")
fi
#This will take a long time the first time
for IMAGE_NAME in "${IMAGE_NAMES[@]}"; do
NAME=$(basename ${IMAGE_NAME%.*})
2015-09-10 15:46:33 +00:00
#If you do decide to use the same key for all, this makes it easier. Only
#creates keys for git-lfs_* images, none of the others should be signing.
if [[ "${NAME}" == git-lfs_* ]] && [ ! -e ${CUR_DIR}/${NAME}.key ]; then
touch ${CUR_DIR}/${NAME}.key
fi
echo Docker building ${NAME}
${CUR_DIR}/docker+.bsh ${IMAGE_NAME} > ${CUR_DIR}/Dockerfile
$SUDO docker build -t git-lfs/${NAME} ${CUR_DIR}
rm ${CUR_DIR}/Dockerfile
2015-07-12 20:49:48 +00:00
done