Reduce Docker image size

- Removed node_modules from client after compilation
 - Added copy-webpack-plugin to copy required JS and fonts to dist
 - Adjusted server to serve files from client/dist
 - add js-yaml to server packages in order to use npm install --production
This commit is contained in:
Markus Opolka 2019-12-05 12:00:07 +01:00
parent ed2655b78e
commit 43edf35637
7 changed files with 258 additions and 18 deletions

View file

@ -1,4 +1,5 @@
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = {
@ -97,7 +98,13 @@ module.exports = {
mailtrainConfig: 'mailtrainConfig'
},
plugins: [
// new webpack.optimize.UglifyJsPlugin(),
new CopyPlugin([
{ from: './node_modules/jquery/dist/jquery.min.js', to: path.resolve(__dirname, 'dist') },
{ from: './node_modules/popper.js/dist/popper.min.js', to: path.resolve(__dirname, 'dist') },
{ from: './node_modules/bootstrap/dist/js/bootstrap.min.js', to: path.resolve(__dirname, 'dist') },
{ from: './node_modules/@coreui/coreui/dist/js/coreui.min.js', to: path.resolve(__dirname, 'dist') },
{ from: './node_modules/@fortawesome/fontawesome-free/webfonts/', to: path.resolve(__dirname, 'dist', 'webfonts'), toType: 'dir'}
]),
],
watchOptions: {
ignored: 'node_modules/',