X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=scripts%2Fdocker%2Fexec.bash;h=3ba2d6f44420e43b0e7b719b2b3953930c3af850;hb=27d34ab291ed6c574432b1331c7ab61172a097d7;hp=e55ce57de700c988020c7985f9bee9d01c85b771;hpb=2fd79ba87b03282756f4d653f121f2811d1584c7;p=blank.git diff --git a/scripts/docker/exec.bash b/scripts/docker/exec.bash index e55ce57..3ba2d6f 100755 --- a/scripts/docker/exec.bash +++ b/scripts/docker/exec.bash @@ -4,35 +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//:/-}" -build_cmd="cd /repo && make -j\$(nproc) $TARGETS" +xvfb_cmd="xvfb-run -a --server-args='-screen 0 1024x768x24 +extension RANDR +extension GLX'" -local_conf="" +build_cmd="git clone /repo /workdir && cd /workdir && make -j\$(nproc) $TARGETS" -if [[ "$TARGETS" == *codecov* ]]; then - local_conf="$local_conf $(bash <(curl -s https://codecov.io/env))" +if [[ "$KEEP" != "" ]]; then + build_cmd="${build_cmd} && cp -Rv $KEEP /repo" fi -if [ -e "${image_path}/env" ]; then - local_conf="$local_conf --env-file ${image_path}/env" -fi -# copy DISPLAY if set -if [ "$DISPLAY" != "" ]; then - local_conf="$local_conf -e DISPLAY=$DISPLAY" -fi +local_conf="" -# copy XDG_RUNTIME_DIR if set -if [ "$XDG_RUNTIME_DIR" != "" ]; then - local_conf="$local_conf -e XDG_RUNTIME_DIR='$XDG_RUNTIME_DIR'" +if [[ "$TARGETS" == *codecov* ]]; then + local_conf="$local_conf $(bash <(curl -s https://codecov.io/env))" fi docker build -t "${image_name}" --pull=true "${image_path}" -docker run -v "$PWD":/repo ${local_conf} "${image_name}" /bin/bash -c "env && ${build_cmd}" +docker run -v "$PWD":/repo ${local_conf} "${image_name}" sh -c "$xvfb_cmd sh -c '${build_cmd}'"