blob: 83c09be336ba718df47d88f73c33d50f77f9d03b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
set -e
cmd="$(basename "$0")"
cwd="$(pwd)"
uid="$(id -u)"
gid="$(id -g)"
[ -t 1 ] && tty=--tty
# Set correct volume permission
docker run \
--rm \
--read-only \
--volume "npm-cache-$uid:/.npm" \
npm \
chown "$uid:$gid" "/.npm"
# Run npm command (or whatever $0 is) inside the Docker container.
exec docker run \
--interactive \
--rm \
$tty \
--user "$uid:$gid" \
--read-only \
--volume "$cwd:$cwd" \
--volume "npm-cache-$uid:/.npm" \
--workdir "$cwd" \
npm \
"$cmd" "$@"
|