From 743fff5cce71f55a9ead82bb55717654d77135e1 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Wed, 8 Sep 2021 09:40:22 +0300 Subject: [PATCH] new version --- package.json | 2 +- private/Docker.txt | 14 +++++++------- webpack.config.prod.js | 25 ++++++++++++++++--------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index bce2ddd..2d5fb1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reverse-proxy-frontend", - "version": "1.0.0", + "version": "1.0.5", "private": true, "description": "Reverse proxy frontend application", "scripts": { diff --git a/private/Docker.txt b/private/Docker.txt index 762cbca..5e61308 100644 --- a/private/Docker.txt +++ b/private/Docker.txt @@ -4,35 +4,35 @@ Docker commands: Create image: --from solution folder: -docker image build -t "reverse-proxy-frontend:1.0.2" . +docker image build -t "reverse-proxy-frontend:1.0.5" . Run image: -docker run -p 5055:80 -it reverse-proxy-frontend:1.0.2 +docker run -p 5055:80 -it reverse-proxy-frontend:1.0.5 Push image to registry: --tag image -docker tag reverse-proxy-frontend:1.0.2 alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.2 +docker tag reverse-proxy-frontend:1.0.5 alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.5 --login to registry docker login --username=admin --password="***REMOVED***" alpine-nexus:8500 --push image -docker push alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.2 +docker push alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.5 Pull image from registry --login to registry --pull image -docker pull alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.2 +docker pull alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.5 Stop old container docker stop reverse-proxy-frontend && docker rm reverse-proxy-frontend Run container in prod env -docker run -d --name reverse-proxy-frontend --restart=always -p 5005:80 alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.2 +docker run -d --name reverse-proxy-frontend --restart=always -p 5005:80 alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.5 Remove old image -docker rmi alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.1 +docker rmi alpine-nexus:8500/reverse-proxy/reverse-proxy-frontend:1.0.2 Get container logs docker logs reverse-proxy-frontend diff --git a/webpack.config.prod.js b/webpack.config.prod.js index 1b36d03..4cfa045 100644 --- a/webpack.config.prod.js +++ b/webpack.config.prod.js @@ -4,15 +4,9 @@ const HtmlWebpackPlugin = require("html-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const webpackBundleAnalyzer = require("webpack-bundle-analyzer"); const CopyPlugin = require("copy-webpack-plugin"); -const config = require("./config"); -process.env.NODE_ENV = config.prod.NODE_ENV; -process.env.PUBLIC_URL = config.prod.PUBLIC_URL; - -let configs = {}; -Object.keys(config.dev).forEach(z => { - configs[`process.env.${z}`] = JSON.stringify(config.dev[z]); -}); +process.env.NODE_ENV = "production"; +process.env.PUBLIC_URL = "/reverse-proxy"; module.exports = { mode: "production", @@ -32,7 +26,20 @@ module.exports = { filename: "[name].[contenthash].css" }), - new webpack.DefinePlugin(configs), + new webpack.DefinePlugin({ + // This global makes sure React is built in prod mode. + "process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), + "process.env.PUBLIC_URL": JSON.stringify(process.env.PUBLIC_URL), + "process.env.REVERSE_PROXY_API_URL": JSON.stringify( + "https://toodle.ddns.net/reverse-proxy-api" + ), + "process.env.CHATBOT_API_URL": JSON.stringify( + "https://toodle.ddns.net/chatbot-api" + ), + "process.env.REVERSE_PROXY_DOCS_URL": JSON.stringify( + "https://toodle.ddns.net/docs/books/reverse-proxy" + ) + }), new HtmlWebpackPlugin({ template: "src/index.html", favicon: "src/favicon.ico",