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

Fix Path Overwrite Issue and Enable CORS for Frontend Access #8

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN pip install fastapi uvicorn python-multipart

RUN pip install streamlit rdflib

COPY ./app /app
COPY ./app /app_py
COPY ./tests /tests

ENTRYPOINT ["bash", "/app/entrypoint.sh"]
ENTRYPOINT ["bash", "/app_py/entrypoint.sh"]
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ Based in https://github.com/SDSC-ORD/shacl
## How to use docker?

```
docker build -t caviri/shaclapi:latest .
docker build -t caviri/shaclapi:latest .
```

```
docker run -it --rm -p 8000:15400 -p 8501:8501 caviri/shaclapi:latest
docker run -it --rm -p 7200:15400 -p 3000:8501 caviri/shaclapi:latest
docker run --rm -p 8501:15400 caviri/shaclapi:latest
```

```
Expand Down
5 changes: 2 additions & 3 deletions app/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/bash
nohup streamlit run /app/webapp/main.py &
python3 -m uvicorn app.main:app --host 0.0.0.0 --port 15400

nohup streamlit run /app_py/webapp/main.py &
python3 -m uvicorn app_py.main:app --host 0.0.0.0 --port 15400
9 changes: 9 additions & 0 deletions app/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import FastAPI, Request, Form
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse
import subprocess
import os
Expand All @@ -11,6 +12,14 @@

app = FastAPI()

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

@app.get("/")
def index():
return {"title": "Hello, welcome to the SHACL API"}
Expand Down