Created
April 21, 2017 23:00
-
-
Save mloberg/10494e70c71f2f479e29b576b410189d to your computer and use it in GitHub Desktop.
WIP: Run npm via Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm () { | |
[ -n "$NODE_VERSION" ] || NODE_VERSION="latest" | |
tty= | |
tty -s && tty=--tty | |
docker run \ | |
$tty \ | |
--interactive \ | |
--rm \ | |
--user $(id -u):$(id -g) \ | |
--volume /etc/passwd:/etc/passwd:ro \ | |
--volume /etc/group:/etc/group:ro \ | |
--volume $HOME/.npm:/.npm \ | |
--volume $(pwd):/app \ | |
--workdir /app \ | |
--entrypoint npm \ | |
"node:${NODE_VERSION}" "$@" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment