Improve docker configs and use web.sik.party:8000 as default backend

This commit is contained in:
Jan Tuomi
2018-08-21 20:13:49 +03:00
parent 63d390aaff
commit a0e05a69e9
9 changed files with 29 additions and 31 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
node_modules/ node_modules/
dist/ dist/
.env
+1 -1
View File
@@ -1 +1 @@
API_URL=http://localhost:1234 API_URL=http://web.sik.party:8000/api
+8 -8
View File
@@ -2,11 +2,11 @@
const {resolve} = require("path"); const {resolve} = require("path");
const {CheckerPlugin} = require("awesome-typescript-loader"); const {CheckerPlugin} = require("awesome-typescript-loader");
const StyleLintPlugin = require("stylelint-webpack-plugin"); const StyleLintPlugin = require("stylelint-webpack-plugin");
const Dotenv = require("dotenv-webpack"); const webpack = require('webpack');
module.exports = function (env, argv) { module.exports = function (env, argv) {
const config = {}; const config = {};
config.resolve = { config.resolve = {
extensions: [".ts", ".tsx", ".js", ".jsx"] extensions: [".ts", ".tsx", ".js", ".jsx"]
}; };
@@ -32,15 +32,15 @@ module.exports = function (env, argv) {
] ]
}); });
const envVars = {};
Object.keys(process.env).forEach((key) => {
envVars[`process.env.${key}`] = JSON.stringify(process.env[key]);
});
config.plugins = [ config.plugins = [
new webpack.DefinePlugin(envVars),
new CheckerPlugin(), new CheckerPlugin(),
new StyleLintPlugin(), new StyleLintPlugin(),
new Dotenv({
path: "./.env.sample"
}),
new Dotenv({
path: "./.env"
}),
]; ];
config.performance = { config.performance = {
+4 -19
View File
@@ -3,6 +3,7 @@ const merge = require("webpack-merge");
const webpack = require("webpack"); const webpack = require("webpack");
const FaviconsWebpackPlugin = require("favicons-webpack-plugin"); const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
const Dotenv = require("dotenv-webpack");
const commonConfig = require("./common.js"); const commonConfig = require("./common.js");
@@ -24,28 +25,12 @@ module.exports = function (env, argv) {
'.sik.party', '.sik.party',
'.sahkoinsinoorikilta.fi', '.sahkoinsinoorikilta.fi',
], ],
proxy: {
'/api': {
target: 'http://localhost:8000',
secure: false,
},
},
// clientLogLevel: 'none',
// https: settings.dev_server.https,
// host: settings.dev_server.host,
// port: settings.dev_server.port,
// contentBase: output.path,
// public: settings.dev_server.public,
// publicPath: output.publicPath,
// compress: true,
// headers: { 'Access-Control-Allow-Origin': '*' },
// historyApiFallback: true,
// watchOptions: {
// ignored: /node_modules/
// }
}; };
base.devtool = "cheap-module-eval-source-map"; base.devtool = "cheap-module-eval-source-map";
base.plugins = base.plugins.concat([ base.plugins = base.plugins.concat([
new Dotenv({
path: "./.env"
}),
new FaviconsWebpackPlugin({ new FaviconsWebpackPlugin({
logo: "./assets/img/favicon.png", logo: "./assets/img/favicon.png",
prefix: "assets/icons/", prefix: "assets/icons/",
-1
View File
@@ -8,7 +8,6 @@ const nodeExternals = require('webpack-node-externals');
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
const WebpackCdnPlugin = require('webpack-cdn-plugin'); const WebpackCdnPlugin = require('webpack-cdn-plugin');
const webpack = require('webpack');
/* NOTE: This is a list of all routes that are prerendered for production use. /* NOTE: This is a list of all routes that are prerendered for production use.
Please list all routes that contain search engine accessible content, i.e., Please list all routes that contain search engine accessible content, i.e.,
+2
View File
@@ -6,4 +6,6 @@ services:
image: git.sahkoinsinoorikilta.fi:4567/vtmk/web2.0-frontend-prod image: git.sahkoinsinoorikilta.fi:4567/vtmk/web2.0-frontend-prod
ports: ports:
- "3000:3000" - "3000:3000"
environment:
API_URL: ${API_URL}
command: npm run start-prod command: npm run start-prod
+9
View File
@@ -6,3 +6,12 @@ services:
image: git.sahkoinsinoorikilta.fi:4567/vtmk/web2.0-frontend image: git.sahkoinsinoorikilta.fi:4567/vtmk/web2.0-frontend
ports: ports:
- "3000:3000" - "3000:3000"
environment:
API_URL: ${API_URL}
mock-backend:
build: .
image: git.sahkoinsinoorikilta.fi:4567/vtmk/web2.0-frontend-mock-backend
ports:
- "1234:1234"
command: npm run mock-backend
+1 -1
View File
@@ -27,7 +27,7 @@
"start-dev": "webpack-dev-server --config=configs/webpack/dev.js", "start-dev": "webpack-dev-server --config=configs/webpack/dev.js",
"serve": "node dist/js/server.js", "serve": "node dist/js/server.js",
"start-prod": "npm run build && npm run serve", "start-prod": "npm run build && npm run serve",
"mock-backend": "json-server --watch db.json -p 1234", "mock-backend": "json-server --watch db.json -H 0.0.0.0 -p 1234",
"test": "npm-run-all lint test:e2e", "test": "npm-run-all lint test:e2e",
"test:e2e": "npm-run-all -s build test:e2e:run", "test:e2e": "npm-run-all -s build test:e2e:run",
"test:e2e:run": "npm-run-all -p -r mock-backend serve test:e2e:testcafe", "test:e2e:run": "npm-run-all -p -r mock-backend serve test:e2e:testcafe",
+2
View File
@@ -5,6 +5,8 @@ import {AppContainer} from "react-hot-loader";
import Routes from "./routes"; import Routes from "./routes";
import "./index.scss"; import "./index.scss";
console.log("Using API URL: ", process.env.API_URL);
const rootEl = document.getElementById("root"); const rootEl = document.getElementById("root");
render( render(