From 847a610d4bcb35b5775b39e9b6a5397ffda1a4b7 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Thu, 5 May 2016 11:15:53 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=A3=D0=B6=D0=B5=20=D0=BF=D0=BE=D1=87?= =?UTF-8?q?=D1=82=D0=B8=20=D0=B2=D1=81=D1=91=20=D0=BD=D0=B0=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=B5=D0=BD=D0=BE=20(=D0=BD=D0=BE=20=D1=81=20node-?= =?UTF-8?q?dev-server=20=D0=B5=D1=81=D1=82=D1=8C=20=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BB=D1=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 2 ++ Dockerfile | 14 ++++++++++++++ webpack.config.js | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ebcd903 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +dist +#node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7fdc180 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:5.11 + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +# Install app dependencies +COPY package.json /usr/src/app/ +RUN npm i + +# Bundle app source +COPY . /usr/src/app + +EXPOSE 8080 +CMD ["npm", "start"] diff --git a/webpack.config.js b/webpack.config.js index 39699dc..c99eb7a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,6 +30,8 @@ var isTest = process.argv.some(function(arg) { return arg.indexOf('karma') !== -1; }); +var isDockerized = !!process.env.DOCKERIZED; + process.env.NODE_ENV = isProduction ? 'production' : 'development'; if (isTest) { process.env.NODE_ENV = 'test'; @@ -205,6 +207,12 @@ var webpackConfig = { ] }; +if (isDockerized) { + webpackConfig.watchOptions = { + poll: 2000 + }; + webpackConfig.devServer.host = '0.0.0.0'; +} if (isProduction) { webpackConfig.module.loaders.forEach((loader) => { From ddefb92a1ea634901442ca3e23d07970cbce4dd7 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Tue, 10 May 2016 01:49:50 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9E=D0=BA=D0=BE=D0=BD=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=B2=D0=BD=D0=B5=D0=B4=D1=80=D0=B5=D0=BD=D0=B8=D0=B5?= =?UTF-8?q?=20=D0=B4=D0=BE=D0=BA=D0=B5=D1=80=D0=B0=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B0=D0=B7=D0=B2=D1=91=D1=80=D1=82=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20dev-=D0=BE=D0=BA=D1=80=D1=83=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 2 +- Dockerfile | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index ebcd903..de4d1f0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,2 @@ dist -#node_modules +node_modules diff --git a/Dockerfile b/Dockerfile index 7fdc180..02a14f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,6 @@ FROM node:5.11 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app -# Install app dependencies -COPY package.json /usr/src/app/ -RUN npm i - # Bundle app source COPY . /usr/src/app