#!/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 "$@"