Skip to content

Commit c0ef0cc

Browse files
committed
Add livereload support
We support this using supervisor as this seems to work well with Docker.
1 parent 14d22e4 commit c0ef0cc

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ COPY . /usr/src/app
1111
RUN ln -s /app/app.js /usr/src/app/
1212
RUN npm install
1313

14-
CMD sh start.sh
14+
CMD sh boot.sh
1515

1616
ONBUILD ADD . /app/
1717
ONBUILD RUN cd /usr/src/app && npm install

boot.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/sh
2+
./node_modules/supervisor/lib/cli-wrapper.js \
3+
-w /usr/src/app,/app \
4+
-i /usr/src/app/node_modules,/app/node_modules \
5+
-e .js \
6+
-k --ignore-symlinks \
7+
-x sh start.sh

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"babel-cli": "^6.18.0",
2121
"babel-preset-es2015": "^6.18.0",
2222
"babel-preset-es2016": "^6.16.0",
23-
"babel-preset-es2017": "^6.16.0"
23+
"babel-preset-es2017": "^6.16.0",
24+
"supervisor": "^0.12.0"
2425
},
2526
"author": "Aad Versteden <aad.versteden@gmail.com>",
2627
"license": "MIT",

start.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#! /bin/sh
2+
3+
## Kill lingering processes
4+
ps aux | grep babel-node | awk '{print $1}' | xargs kill -9
5+
6+
## Install new dependencies
27
npm install
38

9+
## Run using babel
410
NODE_PATH=`pwd`/node_modules:$NODE_PATH ./node_modules/babel-cli/bin/babel-node.js app.js --presets es2015,es2016,es2017
5-

0 commit comments

Comments
 (0)