-
-
Save tichopad/42b5118ab25a4871b83181889179fbd9 to your computer and use it in GitHub Desktop.
Run arbitrary Node version via Docker
This file contains hidden or 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
#!/bin/bash | |
# Example runs: `nv 17 ./script.js`, `nv latest yarn install` | |
# Get Node version | |
VERSION=$1 | |
# Get the rest of the arguments | |
shift | |
ARGUMENTS=$@ | |
docker run \ | |
--interactive \ | |
--network host \ | |
--rm \ | |
--tty \ | |
--user $(id -u):$(id -g) \ | |
--volume $(pwd):/usr/src/app \ | |
--workdir /usr/src/app \ | |
node:$VERSION $ARGUMENTS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment