forked from coreos/tectonic-installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder-run
executable file
·24 lines (21 loc) · 850 Bytes
/
builder-run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash -e
#
# A utility script for executing arbitrary local scripts via docker.
# This can be used for executing build/release scripts locally in our build container in the absence of Jenkins.
#
# USAGE:
#
# With env vars:
# MYVAR=foo OTHERVAR=bar DOCKER_ENV=MYVAR,OTHERVAR ./builder-run ./my-script --my-script-arg1 --my-script-arg2
#
# Without env vars:
# ./builder-run ./my-script --my-script-arg1 --my-script-arg2
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# forward whitelisted env variables to docker
ENV_STR=""
for VAR in ${DOCKER_ENV//,/ }; do
ENV_STR="$ENV_STR -e $VAR=${!VAR}"
done
PROJECT=$SCRIPT_DIR
set -x
docker run --user="${BUILDER_RUN_USER}" $ENV_STR --rm -v $PROJECT:/go/src/github.com/coreos/tectonic-installer -w /go/src/github.com/coreos/tectonic-installer $DOCKER_RUN_ARGS $BUILDER_IMAGE $@