30 lines
816 B
Bash
Executable File
30 lines
816 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# If we're executing from a normal shell, allow input. If we're in a
|
|
# subprocess, like under Jenkins Pipeline, don't allow it
|
|
tty -s
|
|
if [ $? -eq 0 ]; then
|
|
TTY_ARGS="-ti"
|
|
fi;
|
|
|
|
COMMAND=$@
|
|
|
|
# The caller is passing in some custom paraneters to the `node` binary, so we
|
|
# need to override the entrypoint to explicitly call node
|
|
if [[ "${1}" =~ "--" ]]; then
|
|
COMMAND="node $@";
|
|
fi;
|
|
|
|
exec docker run --rm ${TTY_ARGS} --net host \
|
|
-u $(id -u):$(id -g) \
|
|
-w ${PWD} \
|
|
--mount type=tmpfs,destination=/.npm \
|
|
--mount type=tmpfs,destination=/.config \
|
|
-v ${PWD}:${PWD} \
|
|
-e PATH=$PWD/node_modules/.bin:/usr/local/bin:$PATH \
|
|
-e LANG=C.UTF-8 \
|
|
-e LOG_LEVEL=$LOG_LEVEL \
|
|
$(printenv | grep -i \^node | awk '{ print "-e", $1 }') \
|
|
node:9-alpine \
|
|
${COMMAND}
|