]> git.localhorst.tv Git - blank.git/blob - scripts/docker/exec.bash
b146e7647e712ac85e767f08502776a8736614b1
[blank.git] / scripts / docker / exec.bash
1 #!/bin/bash
2
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
9
10 IMAGE="${IMAGE:-archlinux-build}"
11
12 if [[ "$TARGETS" == *codecov* ]]; then
13         ci_env=`bash <(curl -s https://codecov.io/env)`
14 fi
15
16 docker build -t "blank/${IMAGE}" scripts/docker/"${IMAGE}"
17 docker run -v "$PWD":/repo ${ci_env} "blank/${IMAGE}" /bin/bash -c "cd /repo && make -j\$(nproc) $TARGETS"