Files
dotfiles/script/test

28 lines
612 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# --------------------------------------------------------------------
# This script is used to run the install script in a docker container
# and then run the test script.
#
IMAGE=${IMAGE:-"andrejusk/dotfiles"}
uuid=$(
uuidgen 2> /dev/null \
|| cat /proc/sys/kernel/random/uuid 2> /dev/null \
|| echo $RANDOM
)
tag=${TAG:-"$uuid"}
echo "Building $IMAGE:$tag"
docker build . \
--build-arg UUID=$uuid \
--cache-from $IMAGE \
--tag $IMAGE:$tag \
--target test
docker run \
-v "$(pwd)"/logs:/home/test-user/.dotfiles/logs \
$IMAGE:$tag