forked from openshift/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder-run.sh
executable file
·35 lines (30 loc) · 909 Bytes
/
builder-run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
set -e
#
# USAGE:
#
# With env vars:
# MYVAR=foo OTHERVAR=bar DOCKER_ENV=MYVAR,OTHERVAR ./builder-run.sh ./my-script --my-script-arg1 --my-script-arg2
#
# Without env vars:
# ./builder-run.sh ./my-script --my-script-arg1 --my-script-arg2
BUILDER_IMAGE="quay.io/coreos/tectonic-console-builder:v25"
# forward whitelisted env variables to docker
ENV_STR=()
VOLUME_MOUNT=()
for VAR in ${DOCKER_ENV//,/ }; do
if [ "$VAR" = 'KUBECONFIG' ]
then
VOLUME_MOUNT=("-v" "$KUBECONFIG:/kube/config")
ENV_STR+=("-e" "KUBECONFIG=/kube/config")
else
ENV_STR+=("-e" "$VAR=${!VAR}")
fi
done
docker run "${ENV_STR[@]}" --rm --net=host \
--user="${BUILDER_RUN_USER}" \
"${VOLUME_MOUNT[@]}" \
-v "$(pwd)":/go/src/github.com/openshift/console \
--shm-size=512m \
-w /go/src/github.com/openshift/console \
"$BUILDER_IMAGE" "$@"