]> git.localhorst.tv Git - blank.git/blobdiff - scripts/docker/exec.bash
use docker tags to select distro release
[blank.git] / scripts / docker / exec.bash
index b146e7647e712ac85e767f08502776a8736614b1..9874c9a9f49fbe0b4db2d0d06e790f557eeb89b6 100755 (executable)
@@ -9,9 +9,20 @@
 
 IMAGE="${IMAGE:-archlinux-build}"
 
+image_name="localhorsttv/${IMAGE}"
+image_path="scripts/docker/${IMAGE//:/-}"
+
+build_cmd="cd /repo && make -j\$(nproc) $TARGETS"
+
+local_conf=""
+
 if [[ "$TARGETS" == *codecov* ]]; then
-       ci_env=`bash <(curl -s https://codecov.io/env)`
+       local_conf="$local_conf $(bash <(curl -s https://codecov.io/env))"
+fi
+
+if [ -e "${image_path}/env" ]; then
+       local_conf="$local_conf --env-file ${image_path}/env"
 fi
 
-docker build -t "blank/${IMAGE}" scripts/docker/"${IMAGE}"
-docker run -v "$PWD":/repo ${ci_env} "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}" /bin/bash -c "${build_cmd}"