Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite #28

Merged
merged 4 commits into from
Dec 21, 2022
Merged

Vite #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions Dockerfile.serv
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@ WORKDIR /app

COPY ./nomad-front-end/package.json .

RUN npm install --legacy-peer-deps
RUN npm install

COPY ./nomad-front-end .

ENV SKIP_PREFLIGHT_CHECK=true
ENV PORT=3000
# ENV SKIP_PREFLIGHT_CHECK=true
# ENV PORT=3000
#following setting should work for hosting of whole NOMAD app on one machine using nginx reverse proxy
ENV REACT_APP_API_URL=/api
ENV REACT_APP_NMRIUM_URL=/nmrium
ENV VITE_API_URL=/api
ENV VITE_NMRIUM_URL=/nmrium

#Set true if NOMAD submission is used
ENV REACT_APP_SUBMIT_ON=true
ENV REACT_APP_BATCH_SUBMIT_ON=true
ENV REACT_APP_DATASTORE_ON=true
ENV VITE_SUBMIT_ON=true
ENV VITE_BATCH_SUBMIT_ON=true
ENV VITE_DATASTORE_ON=true

RUN npm run build-docker
RUN npm run build


FROM node:16 as nmrium

WORKDIR /app

COPY ./nomad-nmrium/package.json .
COPY ./nomad-nmrium/package-lock.json .

RUN npm install

Expand All @@ -38,7 +37,7 @@ RUN npm run build

FROM nginx:stable-alpine

COPY --from=frontend /app/build /react-builds/frontend
COPY --from=frontend /app/dist /react-builds/frontend

COPY --from=nmrium /app/dist /react-builds/nmrium

Expand Down
21 changes: 10 additions & 11 deletions Dockerfile.serv-tls
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,29 @@ WORKDIR /app

COPY ./nomad-front-end/package.json .

RUN npm install --legacy-peer-deps
RUN npm install

COPY ./nomad-front-end .

ENV SKIP_PREFLIGHT_CHECK=true
ENV PORT=3000
# ENV SKIP_PREFLIGHT_CHECK=true
# ENV PORT=3000
#following setting should work for hosting of whole NOMAD app on one machine using nginx reverse proxy
ENV REACT_APP_API_URL=/api
ENV REACT_APP_NMRIUM_URL=/nmrium
ENV VITE_API_URL=/api
ENV VITE_NMRIUM_URL=/nmrium

#Set true if NOMAD submission is used
ENV REACT_APP_SUBMIT_ON=true
ENV REACT_APP_BATCH_SUBMIT_ON=true
ENV REACT_APP_DATASTORE_ON=true
ENV VITE_SUBMIT_ON=true
ENV VITE_BATCH_SUBMIT_ON=true
ENV VITE_DATASTORE_ON=true

RUN npm run build-docker
RUN npm run build


FROM node:16 as nmrium

WORKDIR /app

COPY ./nomad-nmrium/package.json .
COPY ./nomad-nmrium/package-lock.json .

RUN npm install

Expand All @@ -38,7 +37,7 @@ RUN npm run build

FROM nginx:stable-alpine

COPY --from=frontend /app/build /react-builds/frontend
COPY --from=frontend /app/dist /react-builds/frontend

COPY --from=nmrium /app/dist /react-builds/nmrium

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Server side code for [NOMAD system](https://www.nomad-nmr.uk/) made out of three

### nomad-front-end

React front-end bootstrapped with **[Create React App](https://github.com/facebook/create-react-app)**.
React front-end bootstrapped with **[Vite JS](https://vitejs.dev/)**.

### nomad-rest-api

Expand Down
12 changes: 5 additions & 7 deletions env-example/frontend.env
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
SKIP_PREFLIGHT_CHECK=true
PORT=3003
REACT_APP_API_URL=http://localhost:8080
REACT_APP_NMRIUM_URL=http://localhost:3000
VITE_API_URL=http://localhost:8080
VITE_NMRIUM_URL=http://localhost:3000

#Set true if corresponding NOMAD modules are used
REACT_APP_SUBMIT_ON=true
REACT_APP_BATCH_SUBMIT_ON=true
REACT_APP_DATASTORE_ON=true
VITE_SUBMIT_ON=true
VITE_BATCH_SUBMIT_ON=true
VITE_DATASTORE_ON=true
2 changes: 1 addition & 1 deletion nomad-front-end/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
build
dist
Dockerfile
README.md
.git
Expand Down
42 changes: 21 additions & 21 deletions nomad-front-end/.gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
/config
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
5 changes: 2 additions & 3 deletions nomad-front-end/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ WORKDIR /app

COPY package.json /app/

#--legacy-peer-deps for CRACO being able to use react-scripts@4.0.0 as dev dependency
RUN npm install --legacy-peer-deps
RUN npm install

## next line allows to avoid overwriting node_modules using anonymous volume
RUN mkdir node_modules/.cache && chmod -R 777 node_modules/.cache
RUN chown -R node.node /app/node_modules

COPY . .

Expand Down
68 changes: 0 additions & 68 deletions nomad-front-end/README.md

This file was deleted.

24 changes: 0 additions & 24 deletions nomad-front-end/config-overrides.js

This file was deleted.

30 changes: 0 additions & 30 deletions nomad-front-end/craco.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions nomad-front-end/debug.log

This file was deleted.

13 changes: 13 additions & 0 deletions nomad-front-end/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NOMAD 3</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
</body>
</html>
Loading