Skip to content

Commit

Permalink
Simplified docker-npm
Browse files Browse the repository at this point in the history
  • Loading branch information
firecow committed Mar 22, 2021
1 parent 016026c commit 553f3f6
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions docker-npm
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
#!/bin/bash
set -e

if [[ "${OSTYPE}" = darwin* ]]; then
HOST_SSH_AUTH_SOCK='/run/host-services/ssh-auth.sock'
else
HOST_SSH_AUTH_SOCK="${SSH_AUTH_SOCK}"
fi

mkdir -p /tmp/node-docker-home
chmod 777 -R /tmp/node-docker-home

NPM_HOME=$(docker run -u "$(id -u):$(id -g)" node bash -c 'echo $HOME')
chmod -R 777 /tmp/node-docker-home

docker run -it --rm \
-u "$(id -u):$(id -g)" \
-e SSH_AUTH_SOCK="${HOST_SSH_AUTH_SOCK}" \
-v "${HOST_SSH_AUTH_SOCK}:${HOST_SSH_AUTH_SOCK}" \
-e NPM_HOME=/home/node/ \
-v "/$PWD/:/app/" \
-v "/tmp/node-docker-home/:/$NPM_HOME/" \
-v "/tmp/node-docker-home/:/home/node/" \
-w /app/ \
node npm "$@"

0 comments on commit 553f3f6

Please sign in to comment.