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 # PASS_ENV: names of environment variables to import into
8 # the container during build
10 IMAGE="${IMAGE:-archlinux-build}"
12 image_name="localhorsttv/${IMAGE}"
13 image_path="scripts/docker/${IMAGE//:/-}"
15 build_cmd="cd /repo && make -j\$(nproc) $TARGETS"
19 if [[ "$TARGETS" == *codecov* ]]; then
20 local_conf="$local_conf $(bash <(curl -s https://codecov.io/env))"
23 if [ -e "${image_path}/env" ]; then
24 local_conf="$local_conf --env-file ${image_path}/env"
27 docker build -t "${image_name}" --pull=true "${image_path}"
28 docker run -v "$PWD":/repo ${local_conf} "${image_name}" /bin/bash -c "${build_cmd}"