39 lines
1.3 KiB
Bash
Executable File
39 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# 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
|
|
# DOCKER_LFS_BUILD_VERSION - tag or sha to build envirnment off of. Important
|
|
# in CentOS
|
|
set -eu
|
|
|
|
CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
#If you are not in docker group and you have sudo, default value is sudo
|
|
: ${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:-v0.6.0}
|
|
|
|
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%.*})
|
|
#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
|
|
done
|