From 0acc9d1524031191cdc24185477f9467b3bfbcab Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Thu, 17 Aug 2023 14:34:45 -0500 Subject: [PATCH] Use cerc/webapp-base as Docker base image. --- Dockerfile | 14 ++++++++++++++ config.yml | 4 ++++ package.json | 5 +++-- src/App.js | 8 +++----- src/components/pages/RegisterPage.js | 15 ++++++++------- 5 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 Dockerfile create mode 100644 config.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..aa03ead --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:18-alpine3.15 as builder + +WORKDIR /app + +COPY . . + +RUN rm -rf node_modules && rm -rf build && yarn install +RUN yarn build + +FROM cerc/webapp-base:local + +COPY config.yml /config +RUN mkdir -p /data +COPY --from=builder /app/build /data diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..857a8e7 --- /dev/null +++ b/config.yml @@ -0,0 +1,4 @@ +web: + path: '' +api: + url: 'http://localhost:9393' diff --git a/package.json b/package.json index 22f3cf4..ab23312 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "react-login-page", "version": "0.1.0", - "homepage": "/newuser/", "private": true, + "homepage": "LACONIC_HOSTED_CONFIG_web_path", "dependencies": { "react": "^16.8.6", "react-dom": "^16.8.6", @@ -11,7 +11,8 @@ }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build", + "clean": "rm -rf build", + "build": "NODE_OPTIONS=--openssl-legacy-provider react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/src/App.js b/src/App.js index e460921..2a5fa7f 100644 --- a/src/App.js +++ b/src/App.js @@ -10,15 +10,13 @@ import HomePage from './components/pages/HomePage' import './App.css' export default function App() { + const basePath = "LACONIC_HOSTED_CONFIG_web_path" return (
- - {/**/} - - {/**/} - {/**/} + +
diff --git a/src/components/pages/RegisterPage.js b/src/components/pages/RegisterPage.js index c862c23..4ab689a 100644 --- a/src/components/pages/RegisterPage.js +++ b/src/components/pages/RegisterPage.js @@ -9,9 +9,10 @@ export default function SignUpPage() { const [message, setMessage] = useState(""); let handleSubmit = async (e) => { + const apiBase = "LACONIC_HOSTED_CONFIG_api_url"; e.preventDefault(); try { - let res = await fetch("/register", { + let res = await fetch(`${apiBase}/register`, { method: "POST", headers: { "Content-Type": "application/json", @@ -38,12 +39,12 @@ export default function SignUpPage() { {/*

Join us

*/} {/*
Create your personal account
*/}
-

-
- setUsername(e.target.value)} - required /> -

+ {/*

*/} + {/*
*/} + {/* setUsername(e.target.value)}*/} + {/* required />*/} + {/*

*/}