fabrica/.packer/script/build

32 lines
486 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
set -eo pipefail
PACKER_TEMPLATE=$1
shift
if [ -f '.env' ]; then
set -a
source .env
set +a
fi
export PACKER_KEY_INTERVAL=10ms
export PATH="$PATH:.bin"
function usage {
cat<<EOF
Usage: $0 </chemin/vers/template/packer>
Construit l'image correspondante au template Packer donné
EOF
exit 1
}
[ -z "${PACKER_TEMPLATE}" ] && usage
# Validate template
packer validate ${PACKER_TEMPLATE}
[[ $? -ne 0 ]] && exit 123
packer build $@ ${PACKER_TEMPLATE}