3 # execute from project root
4 # environment varables:
5 # IMAGE: name of the docker image to use
6 # TARGETS: targets to pass to `make` inside the container
7 # KEEP: file names to copy back out after all TARGETS have run
9 IMAGE="${IMAGE:-archlinux-build}"
11 image_name="localhorsttv/${IMAGE}"
12 image_path="scripts/docker/${IMAGE//:/-}"
14 xvfb_cmd="xvfb-run -a --server-args='-screen 0 1024x768x24 +extension RANDR +extension GLX'"
16 build_cmd="cp -R /repo /workdir && cd /workdir && make -j\$(nproc) $TARGETS"
18 if [[ "$KEEP" != "" ]]; then
19 build_cmd="${build_cmd} && cp -Rv $KEEP /repo"
25 if [[ "$TARGETS" == *codecov* ]]; then
26 local_conf="$local_conf $(bash <(curl -s https://codecov.io/env))"
29 docker build -t "${image_name}" --pull=true "${image_path}"
30 docker run -v "$PWD":/repo ${local_conf} "${image_name}" sh -c "$xvfb_cmd sh -c '${build_cmd}'"