mirror of
https://github.com/olehomelchenko/Mini-VLAT-ua.git
synced 2025-12-21 21:22:22 +00:00
feat: dockerize app
This commit is contained in:
4
ReactTool/backend/.dockerignore
Normal file
4
ReactTool/backend/.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
__pycache__
|
||||
*.pyc
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
17
ReactTool/backend/Dockerfile
Normal file
17
ReactTool/backend/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM python:3.9
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY Pipfile Pipfile.lock ./
|
||||
|
||||
RUN pip install pipenv && \
|
||||
pipenv install --system --deploy && \
|
||||
pip install flask-cors
|
||||
|
||||
# Create necessary directories for data storage
|
||||
RUN mkdir -p /app/surveys/quiz
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 5000
|
||||
CMD ["flask", "run", "--host=0.0.0.0"]
|
||||
@@ -13,11 +13,13 @@ import secrets
|
||||
import pandas as pd
|
||||
import db_conf
|
||||
from flask import send_file
|
||||
from flask_cors import CORS
|
||||
#from flask_mail import Mail, Message
|
||||
#import firebase_admin
|
||||
#from firebase_admin import credentials, firestore, initialize_app, firebase
|
||||
|
||||
app = Flask(__name__, static_folder='../frontend/build', static_url_path='/')
|
||||
CORS(app) # Add this line
|
||||
app.config['MYSQL_DATABASE_HOST'] = db_conf.host
|
||||
app.config['MYSQL_DATABASE_USER'] = db_conf.user
|
||||
app.config['MYSQL_DATABASE_PASSWORD'] = db_conf.password
|
||||
|
||||
4
ReactTool/frontend/.dockerignore
Normal file
4
ReactTool/frontend/.dockerignore
Normal file
@@ -0,0 +1,4 @@
|
||||
node_modules
|
||||
build
|
||||
.dockerignore
|
||||
Dockerfile
|
||||
2
ReactTool/frontend/.gitignore
vendored
2
ReactTool/frontend/.gitignore
vendored
@@ -21,3 +21,5 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
*.pyc
|
||||
12
ReactTool/frontend/Dockerfile
Normal file
12
ReactTool/frontend/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM node:16
|
||||
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
COPY yarn.lock ./
|
||||
|
||||
RUN yarn install
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["yarn", "start"]
|
||||
@@ -59,5 +59,5 @@
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"proxy": "http://localhost:5000"
|
||||
"proxy": "http://localhost:3000"
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class Tutorial extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
fetch('./new_session_id', {
|
||||
fetch('http://localhost:8000/new_session_id', {
|
||||
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
|
||||
@@ -178,7 +178,7 @@ class VisQuiz extends Component {
|
||||
|
||||
on_survey_click() {
|
||||
|
||||
fetch('./record_responses_to_db', {
|
||||
fetch('http://localhost:8000/record_responses_to_db', {
|
||||
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user