diff --git a/Dockerfile-production b/Dockerfile-production index 57dc80537a12d810753aa045b6310e32475ec4d4..b674453e48a0a6aa73a4c7c0bbc304f6e072f7cf 100644 --- a/Dockerfile-production +++ b/Dockerfile-production @@ -22,11 +22,17 @@ ARG node_env ARG server_protocol ARG server_host ARG server_port +ARG client_protocol +ARG client_host +ARG client_port ENV NODE_ENV=$node_env ENV SERVER_PROTOCOL=$server_protocol ENV SERVER_HOST=$server_host ENV SERVER_PORT=$server_port +ENV CLIENT_PROTOCOL=$client_protocol +ENV CLIENT_HOST=$client_host +ENV CLIENT_PORT=$client_port RUN yarn pubsweet build diff --git a/docker-compose.production.yml b/docker-compose.production.yml index c384fe6f56b66126f1731887e20f564f357f4bda..93fd3222948c874d31b3667daab9264719fbfa2d 100644 --- a/docker-compose.production.yml +++ b/docker-compose.production.yml @@ -11,6 +11,9 @@ services: - server_protocol=${SERVER_PROTOCOL} - server_host=${SERVER_HOST} - server_port=${SERVER_PORT} + - client_protocol=${CLIENT_PROTOCOL} + - client_host=${CLIENT_HOST} + - client_port=${CLIENT_PORT} ports: - ${SERVER_PORT:-3000}:${SERVER_PORT:-3000} environment: diff --git a/docker-compose.yml b/docker-compose.yml index 661d365e11a8ce522d6e832cc457cf033693db94..a9e21fb04ac462009a8ac256e22b817d7620495d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,7 @@ services: - CLIENT_PORT=${CLIENT_PORT:-4000} - SERVER_PROTOCOL=http - SERVER_HOST=server - - SERVER_PORT=3000 + - SERVER_PORT=${SERVER_PORT:-3000} volumes: - ./app:/home/node/app/app - ./config:/home/node/app/config diff --git a/webpack/plugins.js b/webpack/plugins.js index 9a2c29675264d7660c14ee29a71d195f44e4c003..c0c78395ce80326b96001043bb93e8b3ef25124a 100644 --- a/webpack/plugins.js +++ b/webpack/plugins.js @@ -5,8 +5,8 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin') const CompressionPlugin = require('compression-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') - .BundleAnalyzerPlugin +// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer') +// .BundleAnalyzerPlugin module.exports = (opts = {}) => { const plugins = [] @@ -38,9 +38,15 @@ module.exports = (opts = {}) => { } plugins.push( - new webpack.DefinePlugin({ - 'process.env.NODE_ENV': `"${opts.env}"`, - }), + new webpack.EnvironmentPlugin([ + 'NODE_ENV', + 'SERVER_PROTOCOL', + 'SERVER_HOST', + 'SERVER_PORT', + 'CLIENT_PROTOCOL', + 'CLIENT_HOST', + 'CLIENT_PORT', + ]), ) // put dynamically required modules into the build