Skip to content

Commit

Permalink
added script to run npm installs without having to install NodeJS on …
Browse files Browse the repository at this point in the history
…the host machine
  • Loading branch information
maxlath committed Oct 16, 2018
1 parent f007083 commit 6240439
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -21,6 +21,9 @@ clone the two repos inventaire needs to run :
```
git clone https://github.com/inventaire/inventaire.git
git clone https://github.com/inventaire/entities-search-engine.git
# Install NodeJS dependencies
./scripts/docker_npm inventaire install
./scripts/docker_npm entities-search-engine install
```

Create empty folders for docker volume to dump backup. In accordance with docker-compose volumes, example: `mkdir data couch-test couch es`
Expand Down
13 changes: 13 additions & 0 deletions scripts/docker_npm
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -eu

path=$1
cwd=$(realpath $path)
dir=$(dirname $cwd)
workdir="/opt/${dir}"
uid=$(stat -c '%u' $cwd)

# All args but the first one
npm_args="${@:2}"

docker run --user $uid --rm --volume "${cwd}:/${workdir}" --workdir $workdir node:8 npm --color=always $npm_args

0 comments on commit 6240439

Please sign in to comment.