Use cerc/webapp-base as Docker base image.

This commit is contained in:
Thomas E Lackey 2023-08-17 14:34:45 -05:00
parent ac26f6f46d
commit 0acc9d1524
5 changed files with 32 additions and 14 deletions

14
Dockerfile Normal file
View File

@ -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

4
config.yml Normal file
View File

@ -0,0 +1,4 @@
web:
path: ''
api:
url: 'http://localhost:9393'

View File

@ -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"
},

View File

@ -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 (
<Router>
<div>
<Switch>
<Route exact path="/newuser/" component={ RegisterPage } />
{/*<Route path="/login" component={ LoginPage } />*/}
<Route path="/newuser/register" component={ RegisterPage } />
{/*<Route path="/forget-password" component={ ForgetPasswordPage } />*/}
{/*<Route path="/home" component={ HomePage } />*/}
<Route exact path={basePath} component={ RegisterPage } />
<Route path={basePath + "/register"} component={ RegisterPage } />
</Switch>
<Footer />
</div>

View File

@ -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() {
{/*<h2>Join us</h2>*/}
{/*<h5>Create your personal account</h5>*/}
<form onSubmit={handleSubmit} action="">
<p>
<label>Username</label><br/>
<input type="text" name="username"
onChange={(e) => setUsername(e.target.value)}
required />
</p>
{/*<p>*/}
{/* <label>Username</label><br/>*/}
{/* <input type="text" name="username"*/}
{/* onChange={(e) => setUsername(e.target.value)}*/}
{/* required />*/}
{/*</p>*/}
<p>
<label>Email address</label><br/>
<input type="email" name="email"