X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=scripts%2Fdocker%2Fexec.bash;h=ea6f97daa93e1825dcaeeca1616ca9cafb38953e;hb=7570271f7e1ede3ef65808f859597001338a7fe6;hp=cb6a6651b8d84b376f78607cb75e59671e33cb5c;hpb=bef504fb3ed7cf0a830cbe7fb74bddc682c03d19;p=blank.git diff --git a/scripts/docker/exec.bash b/scripts/docker/exec.bash index cb6a665..ea6f97d 100755 --- a/scripts/docker/exec.bash +++ b/scripts/docker/exec.bash @@ -4,20 +4,27 @@ # environment varables: # IMAGE: name of the docker image to use # TARGETS: targets to pass to `make` inside the container -# PASS_ENV: names of environment variables to import into -# the container during build +# KEEP: file names to copy back out after all TARGETS have run IMAGE="${IMAGE:-archlinux-build}" +image_name="localhorsttv/${IMAGE}" +image_path="scripts/docker/${IMAGE//:/-}" + +xvfb_cmd="xvfb-run -a --server-args='-screen 0 1024x768x24 +extension RANDR +extension GLX'" + +build_cmd="cp -R /repo /workdir && cd /workdir && make -j\$(nproc) $TARGETS" + +if [[ "$KEEP" != "" ]]; then + build_cmd="${build_cmd} && cp -Rv $KEEP /repo" +fi + + local_conf="" if [[ "$TARGETS" == *codecov* ]]; then local_conf="$local_conf $(bash <(curl -s https://codecov.io/env))" fi -if [ -e scripts/docker/"${IMAGE}"/env ]; then - local_conf="$local_conf --env-file scripts/docker/${IMAGE}/env" -fi - -docker build -t "blank/${IMAGE}" scripts/docker/"${IMAGE}" -docker run -v "$PWD":/repo ${local_conf} "blank/${IMAGE}" /bin/bash -c "cd /repo && make -j\$(nproc) $TARGETS" +docker build -t "${image_name}" --pull=true "${image_path}" +docker run -v "$PWD":/repo ${local_conf} "${image_name}" sh -c "$xvfb_cmd sh -c '${build_cmd}'"