]> git.localhorst.tv Git - blank.git/blobdiff - scripts/docker/exec.bash
some docker scripts
[blank.git] / scripts / docker / exec.bash
diff --git a/scripts/docker/exec.bash b/scripts/docker/exec.bash
new file mode 100755 (executable)
index 0000000..b146e76
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# execute from project root
+# 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
+
+IMAGE="${IMAGE:-archlinux-build}"
+
+if [[ "$TARGETS" == *codecov* ]]; then
+       ci_env=`bash <(curl -s https://codecov.io/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"