Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit bfaf3cf

Browse files
butlerxDanielBrierton
authored andcommitted
only run npm install on first setup
1 parent 685353d commit bfaf3cf

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ MAINTAINER butlerx <[email protected]>
44
RUN apk add --update git build-base python postgresql-client && \
55
mkdir -p /usr/src/app
66
WORKDIR /usr/src/app
7-
ADD . /usr/src/app/
7+
COPY . /usr/src/app/
88
RUN npm install && \
99
rm -rf /root/.npm && \
1010
apk del build-base python && \
1111
rm -rf /tmp/* /root/.npm /root/.node-gyp
1212
EXPOSE 10303
13-
CMD ["node", "service.js"]
13+
CMD ["npm", "start"]

dev.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ FROM mhart/alpine-node:0.10.48
22
MAINTAINER butlerx <[email protected]>
33

44
RUN apk add --update git build-base python postgresql-client && \
5-
npm install -g nodemon && \
65
mkdir -p /usr/src/app /usr/src/cp-translations
7-
ADD docker-entrypoint.sh /usr/src
6+
COPY docker-entrypoint.sh /usr/src
87
EXPOSE 10303
98
VOLUME /usr/src/app /usr/src/cp-translations
109
CMD ["/usr/src/docker-entrypoint.sh"]

docker-entrypoint.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#! /usr/bin/env sh
2-
cd /usr/src/cp-translations || exit
3-
npm link
42
cd /usr/src/app || exit
5-
npm install && npm link cp-translations
6-
nodemon service.js
3+
if [ ! -d "node_modules" ]; then
4+
npm install
5+
rm -rf node_modules/cp-translations
6+
ln -s /usr/src/cp-translations node_modules/cp-translations
7+
fi
8+
npm run dev

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"test": "npm run lint && bash -c 'source ./config/development.env; ./node_modules/.bin/lab --ignore __core-js_shared__ --flat --threshold 50 -r html -o ./coverage/coverage.html -r lcov -o ./coverage/lcov.info -r json -o ./coverage/coverage.json -r lab-quieter-reporter -o stdout -m 5000'",
1111
"testdata": "node test/lib/service.js",
1212
"covrep": "bash test/covrep.sh",
13-
"lint": "./node_modules/.bin/semistandard *.js config/config.js"
13+
"lint": "./node_modules/.bin/semistandard *.js config/config.js",
14+
"start": "node service.js",
15+
"dev": "nodemon service.js"
1416
},
1517
"pre-commit": [
1618
"test"
@@ -58,6 +60,7 @@
5860
"chai": "2.2.0",
5961
"lab": "5.15.1",
6062
"lab-quieter-reporter": "1.0.1",
63+
"nodemon": "^1.11.0",
6164
"pre-commit": "1.1.2",
6265
"semistandard": "7.0.3",
6366
"sinon": "^2.3.4",

0 commit comments

Comments
 (0)