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:
parent
ed2655b78e
commit
43edf35637
7 changed files with 258 additions and 18 deletions
|
@ -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/',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue