Skip to content

Commit af211ed

Browse files
committed
Support execution of npm prepare scripts in Docker container
Workaround suggested in npm/npm#18163.
1 parent 2c9bde1 commit af211ed

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WORKDIR /usr/src/app
1212
COPY . /usr/src/app
1313

1414
RUN ln -s /app/app.js /usr/src/app/
15-
RUN npm install
15+
RUN npm config set unsafe-perm true && npm install
1616

1717
CMD sh boot.sh
1818

@@ -23,4 +23,4 @@ ONBUILD RUN if [ -f /app/on-build.sh ]; \
2323
&& chmod +x /app/on-build.sh \
2424
&& /bin/bash /app/on-build.sh ;\
2525
fi
26-
ONBUILD RUN if [ -f "/app/package.json" ]; then npm install /app; fi
26+
ONBUILD RUN if [ -f "/app/package.json" ]; then npm config set unsafe-perm true && npm install /app; fi

boot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ then
77
-x sh start.sh
88
else
99
## Install new dependencies
10-
if [ -f "/app/package.json" ]; then npm install /app; fi
10+
if [ -f "/app/package.json" ]; then npm config set unsafe-perm true && npm install /app; fi
1111
## Boot the app in development mode
1212
./node_modules/supervisor/lib/cli-wrapper.js \
1313
-w /usr/src/app,/app \

0 commit comments

Comments
 (0)