Skip to content

Commit

Permalink
Merge pull request #5 from lucianavlop/react-migration
Browse files Browse the repository at this point in the history
React migration
  • Loading branch information
lucianavlop authored Apr 27, 2023
2 parents 3b4c2c9 + 57f2b78 commit 77d767f
Show file tree
Hide file tree
Showing 37 changed files with 40,139 additions and 330 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
npm-debug.log
build
dist
gradle
.classpath
.project
*.bat
*.sh
yarn.lock
28 changes: 23 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
.env*
__pycache__
actions-runner
logs
.DS_Store
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

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

npm-debug.log*
yarn-debug.log*
yarn-error.log*
7 changes: 7 additions & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
arrowParens: "avoid"
bracketSameLine: true
bracketSpacing: true
singleQuote: false
trailingComma: "all"
semi: false
tabWidth: 4
27 changes: 18 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
FROM python:3.11.3
# build
FROM node:14 AS builder

# Set the working directory to /app
WORKDIR /app

# Install dependencies
COPY requirements.txt /app
RUN pip install --trusted-host pypi.python.org -r requirements.txt
COPY package.json ./

# Copy source code
COPY . /app
RUN yarn --network-timeout 100000

# Run the app
CMD ["streamlit", "run", "Electricity.py"]
COPY ./src ./src
COPY ./public ./public
COPY ./tsconfig.json tsconfig.json

RUN yarn build

# deployment
FROM nginx:1.19-alpine AS deployment

COPY --from=builder /app/build /usr/share/nginx/html
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY ./nginx/nginx.conf /etc/nginx/nginx.conf

CMD nginx -g 'daemon off;'
171 changes: 0 additions & 171 deletions Electricity.py

This file was deleted.

46 changes: 46 additions & 0 deletions README copy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
A simple dashboard to display the PVPC electricity prices in Spain.

## Stack
- Python3
- Streamlit
- Docker
- ReactJS
- Material-UI
- Nginx

## API
Requires an instances on this [API](https://github.com/daithihearn/electricity-prices)
16 changes: 16 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.5"

services:
daithi-dashboard:
image: daithi-dashboard
container_name: daithi-dashboard
restart: "no"
ports:
- 3000:80
networks:
- dash

networks:
dash:
driver: bridge
name: dash
1 change: 0 additions & 1 deletion example.env

This file was deleted.

44 changes: 44 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
server {
listen 80;

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Loading

0 comments on commit 77d767f

Please sign in to comment.