Last active
November 3, 2022 21:43
-
-
Save fedorg/3c7b8a4b58d50764c84b760c06f9de56 to your computer and use it in GitHub Desktop.
Docker aliases to node, npm, npx to run in .bashrc
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
node_env='development' | |
node_image='node' | |
function run_node() { | |
args=( "$@" ) | |
shift | |
binary="${args[0]}" | |
docker run --net=host --user $(id -u):$(id -g) -it --rm -e HOME=$HOME -e NODE_ENV=$node_env -v $HOME:$HOME -v $(pwd):/usr/app/ -w /usr/app --entrypoint $binary $node_image $@ | |
} | |
function npm() { run_node npm $@; } | |
function node() { run_node node $@; } | |
function npx() { run_node npx $@; } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment