diff --git a/Dockerfile b/Dockerfile index 6e9e7da..7eb0d7d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ LABEL org.opencontainers.image.title="Jellomator" \ org.opencontainers.image.source="${VCS_URL}" \ org.opencontainers.image.revision="${VCS_REF}" COPY backend ./backend +COPY public ./public COPY --from=frontend /app/frontend/dist ./frontend/dist RUN pip install --no-cache-dir -r backend/requirements.txt EXPOSE 6363 diff --git a/backend/main.py b/backend/main.py index 5730c91..57f95ab 100644 --- a/backend/main.py +++ b/backend/main.py @@ -298,11 +298,15 @@ if STATIC_DIR.exists(): app.mount("/assets", StaticFiles(directory=STATIC_DIR / "assets"), name="assets") if PUBLIC_DIR.exists(): app.mount("/static", StaticFiles(directory=PUBLIC_DIR), name="public") +elif STATIC_DIR.exists(): + app.mount("/static", StaticFiles(directory=STATIC_DIR), name="public-dist") @app.get("/jellomator.png") def root_icon(): icon = PUBLIC_DIR / "jellomator.png" + if not icon.exists(): + icon = STATIC_DIR / "jellomator.png" if not icon.exists(): raise HTTPException(404, "Not found") return FileResponse(icon) @@ -312,6 +316,8 @@ def root_icon(): def spa(path: str): if path.startswith("api/"): raise HTTPException(404) + if "." in path: + raise HTTPException(404) index = STATIC_DIR / "index.html" if index.exists(): return FileResponse(index) diff --git a/index.html b/index.html index 5ee8cb3..c0689da 100644 --- a/index.html +++ b/index.html @@ -4,9 +4,9 @@ - - - + + +