diff --git a/backend/.vscode/launch.json b/backend/.vscode/launch.json index 9475a54..ab4883f 100644 --- a/backend/.vscode/launch.json +++ b/backend/.vscode/launch.json @@ -9,6 +9,7 @@ "type": "python", "request": "launch", "module": "flask", + "preLaunchTask": "Launch MongoDB", "env": { "FLASK_APP": "app/main.py", "FLASK_ENV": "development", @@ -19,7 +20,28 @@ "--no-debugger", "--no-reload" ], - "jinja": true + "jinja": true, + "postDebugTask": "Stop MongoDB" + }, + { + "name": "Python: Flask (open to world)", + "type": "python", + "request": "launch", + "module": "flask", + "preLaunchTask": "Launch MongoDB", + "env": { + "FLASK_APP": "app/main.py", + "FLASK_ENV": "development", + "FLASK_DEBUG": "0" + }, + "args": [ + "run", + "--no-debugger", + "--no-reload", + "--host=0.0.0.0" + ], + "jinja": true, + "postDebugTask": "Stop MongoDB" } ] } \ No newline at end of file diff --git a/backend/.vscode/tasks.json b/backend/.vscode/tasks.json new file mode 100644 index 0000000..ca61a5a --- /dev/null +++ b/backend/.vscode/tasks.json @@ -0,0 +1,50 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "Launch MongoDB", + "type": "shell", + "command": "docker-compose -f ${workspaceFolder}/docker/docker-compose.dev.yml up", + "isBackground": true, + "problemMatcher": [ + { + "pattern": [ + { + "regexp": ".", + "file": 1, + "location": 2, + "message": 3 + } + ], + "background": { + "activeOnStart": true, + "beginsPattern": ".", + "endsPattern": "." + } + } + ], + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared", + "showReuseMessage": true, + "clear": true + }, + "group": "build" + }, + { + "label": "Stop MongoDB", + "type": "shell", + "command": "docker-compose -f ${workspaceFolder}/docker/docker-compose.dev.yml stop" + }, + { + "label": "Reset MongoDB", + "type": "shell", + "command": "docker-compose -f ${workspaceFolder}/docker/docker-compose.dev.yml rm -sf", + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/backend/docker/Dockerfile b/backend/docker/Dockerfile new file mode 100644 index 0000000..ac45abf --- /dev/null +++ b/backend/docker/Dockerfile @@ -0,0 +1,11 @@ +FROM tiangolo/uwsgi-nginx-flask:python3.7 + +RUN pip install requests + +RUN pip install pandas + +RUN pip install Flask-BasicAuth + +RUN pip install bs4 + +COPY ../app /app \ No newline at end of file diff --git a/backend/docker/docker-compose.dev.yml b/backend/docker/docker-compose.dev.yml new file mode 100644 index 0000000..7f110ce --- /dev/null +++ b/backend/docker/docker-compose.dev.yml @@ -0,0 +1,14 @@ +version: '2' +services: + mongo: + extends: + file: docker-compose.yml + service: mongo + + mongo-express: + depends_on: + - mongo + image: mongo-express + restart: always + ports: + - "8081:8081" diff --git a/backend/docker/docker-compose.yml b/backend/docker/docker-compose.yml new file mode 100644 index 0000000..9f6b0ff --- /dev/null +++ b/backend/docker/docker-compose.yml @@ -0,0 +1,12 @@ +version: '2' +services: + mongo: + image: mongo + restart: always + ports: + - "27017:27017" + + backend: + depends_on: + - mongo + build: .