2c7e9de3 by Adam Heath

A helper script that runs node in a container.

1 parent 38e7b782
#!/bin/sh
set -e
TOP_DIR="$(cd "$(dirname "$0")/.."; pwd -P)"
ti_arg=""
if [ -t 0 ]; then
ti_arg="-ti"
fi
docker run --rm $ti_arg \
-e UID_REMAP=$(id -u) -e GID_REMAP=$(id -g) \
-v "$TOP_DIR/container-entrypoint.sh:/container-entrypoint.sh" --entrypoint /container-entrypoint.sh \
-w /srv/app \
-v "$TOP_DIR:/srv/app" \
$DOCKER_ARGS \
node "$@"
#!/bin/bash
set -e
if [[ 0 -eq $(id -u) ]]; then
[[ $UID_REMAP ]] && usermod -u $UID_REMAP node
[[ $GID_REMAP ]] && groupmod -g $GID_REMAP node
fi
if [[ $# -eq 0 ]]; then
set -- bash
fi
cmd="$1"
shift
start-stop-daemon -c node -d $PWD -u node --start --exec "$(which "$cmd")" -- "$@"