diff --git a/docker/Dockerfile b/docker/Dockerfile index f90130e9..4db3138d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,7 +3,7 @@ MAINTAINER mickael.kerjean@gmail.com RUN apk add --no-cache git && \ # INSTALL SYSTEM DEPS - git clone https://github.com/mickael-kerjean/nuage /app && \ + git clone https://github.com/mickael-kerjean/nuage /app && \ cd /app && \ apk add --no-cache nodejs libcurl && \ # Nodegit @@ -12,10 +12,10 @@ RUN apk add --no-cache git && \ apk del .build-deps && \ npm install && \ # PRODUCTION BUILD - npm run build && \ - npm prune --production + NODE_ENV=production npm run build && \ + npm prune --production EXPOSE 8334 WORKDIR "/app" ENV NODE_ENV production -CMD ["node", "/app/server/index"] \ No newline at end of file +CMD ["node", "/app/server/index"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 93d9a9e8..92284f92 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -13,11 +13,4 @@ services: transcode: container_name: nuage_transcode image: machines/nuage_transcode - restart: always - - reverse_proxy: - container_name: nuage_reverse_proxy - image: machines/nuage_reverse_proxy - restart: always - ports: - - "8888:80" \ No newline at end of file + restart: always \ No newline at end of file diff --git a/package.json b/package.json index 908ace8f..451cb2d7 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "main": "server/index.js", "scripts": { "dev": "webpack --watch", - "build": "NODE_ENV=production webpack -p", + "build": "webpack", "image": "docker build -t nuage -f ./docker/Dockerfile .", "publish": "docker tag nuage machines/nuage && docker push machines/nuage", "clean": "rm -rf server/public/js server/public/*.html || true", @@ -36,6 +36,7 @@ "ssh2-sftp-client": "^1.1.0", "stream-to-string": "^1.1.0", "string-to-stream": "^1.1.0", + "uglifyjs-webpack-plugin": "^1.2.5", "webdav-fs": "^1.10.1", "winston": "^2.3.1", "winston-couchdb": "^0.6.3" diff --git a/server/utils/mimetype.js b/server/utils/mimetype.js index 2659cd54..604970bf 100644 --- a/server/utils/mimetype.js +++ b/server/utils/mimetype.js @@ -1,4 +1,4 @@ -var path = require('path'); +const path = require('path'); module.exports.getMimeType = function(file){ let ext = path.extname(file).replace(/^\./, '').toLowerCase(); @@ -231,6 +231,6 @@ const db = { "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation" -} +}; module.exports.mime = db; diff --git a/webpack.config.js b/webpack.config.js index d1a4d4b8..21cd46d6 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ const webpack = require('webpack'); const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; +const UglifyJSPlugin = require("uglifyjs-webpack-plugin"); let config = { entry: { @@ -47,29 +48,19 @@ let config = { new HtmlWebpackPlugin({ template: path.join(__dirname, 'client', 'index.html'), inject:true - }) + }), + //new BundleAnalyzerPlugin() ] }; if(process.env.NODE_ENV === 'production'){ - config.plugins.push(new webpack.optimize.UglifyJsPlugin()); + config.plugins.push(new UglifyJSPlugin({ + sourceMap: false + })); }else{ config.devtool = '#inline-source-map'; - config.devServer = { - contentBase: path.join(__dirname, "server", "public"), - disableHostCheck: true, - hot: true, - historyApiFallback: { - index: 'index.html' - }, - proxy: { - '/api': { - target: 'http://127.0.0.1:3000' - } - } - }; } module.exports = config;