Commit 8811c35b authored by Vũ Hoàng Anh's avatar Vũ Hoàng Anh

fix: serve index.html directly on root and update docker port mapping to 8000

parent 371783cc
...@@ -29,9 +29,14 @@ _static_dir = os.path.join(os.path.dirname(__file__), "static") ...@@ -29,9 +29,14 @@ _static_dir = os.path.join(os.path.dirname(__file__), "static")
if os.path.isdir(_static_dir): if os.path.isdir(_static_dir):
app.mount("/static", StaticFiles(directory=_static_dir, html=True), name="static") app.mount("/static", StaticFiles(directory=_static_dir, html=True), name="static")
from fastapi.responses import FileResponse
@app.get("/") @app.get("/")
async def root(): async def root():
return RedirectResponse(url="/static/index.html") index_path = os.path.join(_static_dir, "index.html")
if os.path.exists(index_path):
return FileResponse(index_path)
return {"error": "index.html not found"}
def _looks_like_low_information_markdown(md_text: str) -> bool: def _looks_like_low_information_markdown(md_text: str) -> bool:
......
...@@ -7,7 +7,7 @@ services: ...@@ -7,7 +7,7 @@ services:
container_name: doc-converter container_name: doc-converter
restart: unless-stopped restart: unless-stopped
ports: ports:
- "5005:8000" - "8000:8000"
dns: dns:
- 8.8.8.8 # DNS của Google - 8.8.8.8 # DNS của Google
- 1.1.1.1 # DNS của Cloudflare - 1.1.1.1 # DNS của Cloudflare
...@@ -16,6 +16,7 @@ services: ...@@ -16,6 +16,7 @@ services:
- ./docx_converter.py:/app/docx_converter.py - ./docx_converter.py:/app/docx_converter.py
- ./ocr_drive.py:/app/ocr_drive.py - ./ocr_drive.py:/app/ocr_drive.py
- ./ocr_service_account.json:/app/ocr_service_account.json - ./ocr_service_account.json:/app/ocr_service_account.json
- ./text_to_markdown.py:/app/text_to_markdown.py
extra_hosts: extra_hosts:
- "host.docker.internal:host-gateway" - "host.docker.internal:host-gateway"
command: ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] command: ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment