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) => {