Skip to content

Commit

Permalink
- Added npm install --production step to Dockerfile
Browse files Browse the repository at this point in the history
- Removed `npm prune` step from build dockerfile
- added `node_modules` back into dockerignore
  • Loading branch information
maxcbc committed Oct 31, 2017
1 parent 698173c commit 5301264
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ docs
.sass-lint.yml
CONTRIBUTING.md
env.sh
node_modules
node_modules_local
docker/build_and_test.Dockerfile
Dockerfile
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ FROM node:6.11.1-alpine

RUN apk update &&\
apk upgrade &&\
apk add --update bash libc6-compat
apk add --update bash python make g++ libc6-compat

ENV PORT 9000
EXPOSE 9000

ADD package.json /tmp/package.json
RUN cd /tmp && npm install --production

WORKDIR /app
ADD . /app

RUN cp -a /tmp/node_modules /app/

CMD npm start
21 changes: 2 additions & 19 deletions build-local.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
#!/bin/bash

if [ -d "node_modules_local" ]; then
rm -rf node_modules_local
fi

if [ -d "node_modules" ]; then
mv node_modules node_modules_local
fi

docker build --file docker/build_and_test.Dockerfile -t govukpay/selfservice-build:local . &&\
docker run --volume $(pwd):/app:rw govukpay/selfservice-build:local &&\
docker build -t govukpay/selfservice:local .

if [ -d "node_modules" ]; then
rm -rf node_modules
fi

if [ -d "node_modules_local" ]; then
mv node_modules_local node_modules
fi
npm install && npm run compile &&\
docker build -t govukpay/selfservice:local .
3 changes: 1 addition & 2 deletions docker/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ grep -rnw './test' -e 'context.only' && echo '' && echo 'ERROR: context.only() f
mkdir -p /app &&\
cp -a /tmp/node_modules /app/ &&\
npm run compile &&\
npm test &&\
npm prune --production
npm test

0 comments on commit 5301264

Please sign in to comment.