]> git.localhorst.tv Git - blank.git/blob - scripts/docker/exec.bash
ubuntu latest and devel docker images
[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 local_conf=""
13
14 if [[ "$TARGETS" == *codecov* ]]; then
15         local_conf="$local_conf $(bash <(curl -s https://codecov.io/env))"
16 fi
17
18 if [ -e scripts/docker/"${IMAGE}"/env ]; then
19         local_conf="$local_conf --env-file scripts/docker/${IMAGE}/env"
20 fi
21
22 docker build -t "blank/${IMAGE}" scripts/docker/"${IMAGE}"
23 docker run -v "$PWD":/repo ${local_conf} "blank/${IMAGE}" /bin/bash -c "cd /repo && make -j\$(nproc) $TARGETS"