From 490c540d8f454cfad041364839aee6b41c39240c Mon Sep 17 00:00:00 2001 From: Lawrence Date: Mon, 31 Jul 2017 13:43:51 +0100 Subject: [PATCH] Fix for docker build --- .dockerignore | 22 ++++++++++++++++++++++ Dockerfile | 22 ++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2d80d5d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,22 @@ +# dependencies +node_modules/ + +# testing +/coverage + +# misc +.DS_Store +.env +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# generated files +client/**/*.css + +# generated merge temp files +*.orig + +# private files +*.private.* +!*sample.basic.private.js \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 43e077a..0e0cdbf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,33 @@ -FROM node:6.11-alpine +FROM node:8.2.1-alpine # Create app directory RUN mkdir -p /usr/src/app +RUN mkdir -p /usr/src/app/client +RUN mkdir -p /usr/src/app/server WORKDIR /usr/src/app # Install app dependencies COPY package.json /usr/src/app/ +COPY package-lock.json /usr/src/app/ +COPY yarn.lock /usr/src/app/ + +COPY server/yarn.lock /usr/src/app/server +COPY server/package.json /usr/src/app/server +COPY server/package-lock.json /usr/src/app/server + +COPY client/yarn.lock /usr/src/app/client +COPY client/package.json /usr/src/app/client +COPY client/package-lock.json /usr/src/app/client + RUN npm install yarn -g -RUN npm install +RUN yarn # Bundle app source COPY . /usr/src/app +# Build client assets +WORKDIR /usr/src/app/client +RUN yarn build + +WORKDIR /usr/src/app/ CMD [ "npm", "start" ]