mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-28 12:16:48 +08:00
fix (build): fix webpack crap
This commit is contained in:
@ -3,7 +3,7 @@ MAINTAINER mickael.kerjean@gmail.com
|
|||||||
|
|
||||||
RUN apk add --no-cache git && \
|
RUN apk add --no-cache git && \
|
||||||
# INSTALL SYSTEM DEPS
|
# INSTALL SYSTEM DEPS
|
||||||
git clone https://github.com/mickael-kerjean/nuage /app && \
|
git clone https://github.com/mickael-kerjean/nuage /app && \
|
||||||
cd /app && \
|
cd /app && \
|
||||||
apk add --no-cache nodejs libcurl && \
|
apk add --no-cache nodejs libcurl && \
|
||||||
# Nodegit
|
# Nodegit
|
||||||
@ -12,10 +12,10 @@ RUN apk add --no-cache git && \
|
|||||||
apk del .build-deps && \
|
apk del .build-deps && \
|
||||||
npm install && \
|
npm install && \
|
||||||
# PRODUCTION BUILD
|
# PRODUCTION BUILD
|
||||||
npm run build && \
|
NODE_ENV=production npm run build && \
|
||||||
npm prune --production
|
npm prune --production
|
||||||
|
|
||||||
EXPOSE 8334
|
EXPOSE 8334
|
||||||
WORKDIR "/app"
|
WORKDIR "/app"
|
||||||
ENV NODE_ENV production
|
ENV NODE_ENV production
|
||||||
CMD ["node", "/app/server/index"]
|
CMD ["node", "/app/server/index"]
|
||||||
|
|||||||
@ -13,11 +13,4 @@ services:
|
|||||||
transcode:
|
transcode:
|
||||||
container_name: nuage_transcode
|
container_name: nuage_transcode
|
||||||
image: machines/nuage_transcode
|
image: machines/nuage_transcode
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
reverse_proxy:
|
|
||||||
container_name: nuage_reverse_proxy
|
|
||||||
image: machines/nuage_reverse_proxy
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- "8888:80"
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
"main": "server/index.js",
|
"main": "server/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack --watch",
|
"dev": "webpack --watch",
|
||||||
"build": "NODE_ENV=production webpack -p",
|
"build": "webpack",
|
||||||
"image": "docker build -t nuage -f ./docker/Dockerfile .",
|
"image": "docker build -t nuage -f ./docker/Dockerfile .",
|
||||||
"publish": "docker tag nuage machines/nuage && docker push machines/nuage",
|
"publish": "docker tag nuage machines/nuage && docker push machines/nuage",
|
||||||
"clean": "rm -rf server/public/js server/public/*.html || true",
|
"clean": "rm -rf server/public/js server/public/*.html || true",
|
||||||
@ -36,6 +36,7 @@
|
|||||||
"ssh2-sftp-client": "^1.1.0",
|
"ssh2-sftp-client": "^1.1.0",
|
||||||
"stream-to-string": "^1.1.0",
|
"stream-to-string": "^1.1.0",
|
||||||
"string-to-stream": "^1.1.0",
|
"string-to-stream": "^1.1.0",
|
||||||
|
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||||
"webdav-fs": "^1.10.1",
|
"webdav-fs": "^1.10.1",
|
||||||
"winston": "^2.3.1",
|
"winston": "^2.3.1",
|
||||||
"winston-couchdb": "^0.6.3"
|
"winston-couchdb": "^0.6.3"
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
var path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports.getMimeType = function(file){
|
module.exports.getMimeType = function(file){
|
||||||
let ext = path.extname(file).replace(/^\./, '').toLowerCase();
|
let ext = path.extname(file).replace(/^\./, '').toLowerCase();
|
||||||
@ -231,6 +231,6 @@ const db = {
|
|||||||
"docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
"docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||||
}
|
};
|
||||||
|
|
||||||
module.exports.mime = db;
|
module.exports.mime = db;
|
||||||
|
|||||||
@ -2,6 +2,7 @@ const webpack = require('webpack');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||||
|
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
|
||||||
|
|
||||||
let config = {
|
let config = {
|
||||||
entry: {
|
entry: {
|
||||||
@ -47,29 +48,19 @@ let config = {
|
|||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: path.join(__dirname, 'client', 'index.html'),
|
template: path.join(__dirname, 'client', 'index.html'),
|
||||||
inject:true
|
inject:true
|
||||||
})
|
}),
|
||||||
|
//new BundleAnalyzerPlugin()
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(process.env.NODE_ENV === 'production'){
|
if(process.env.NODE_ENV === 'production'){
|
||||||
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
|
config.plugins.push(new UglifyJSPlugin({
|
||||||
|
sourceMap: false
|
||||||
|
}));
|
||||||
}else{
|
}else{
|
||||||
config.devtool = '#inline-source-map';
|
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;
|
module.exports = config;
|
||||||
|
|||||||
Reference in New Issue
Block a user