Fixed packaging of static files
This commit is contained in:
parent
4291c845d8
commit
9266a1f131
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
__pycache__
|
||||
dist
|
||||
*.pyc
|
||||
|
||||
10
Dockerfile
10
Dockerfile
@ -1,12 +1,12 @@
|
||||
FROM recoll
|
||||
|
||||
RUN apt-get install breeze-icon-theme
|
||||
RUN apt-get -y install breeze-icon-theme python3-venv
|
||||
|
||||
COPY . /opt/squirrel
|
||||
WORKDIR /opt/squirrel
|
||||
COPY dist/squirrel-0.3.0-py3-none-any.whl squirrel-0.3.0-py3-none-any.whl
|
||||
|
||||
RUN pip install --break-system-packages -e .
|
||||
RUN python3 -m venv --system-site-packages /opt/squirrel
|
||||
RUN /opt/squirrel/bin/pip install squirrel-0.3.0-py3-none-any.whl
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/bin/bash"]
|
||||
ENTRYPOINT ["/opt/squirrel/bin/squirrel"]
|
||||
|
||||
@ -5,6 +5,7 @@ from fastapi.templating import Jinja2Templates
|
||||
from typing import Any
|
||||
import logging
|
||||
import subprocess
|
||||
import os.path
|
||||
|
||||
from recoll import recoll
|
||||
|
||||
@ -15,6 +16,8 @@ from fastapi import BackgroundTasks
|
||||
logger = logging.getLogger()
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
SQUIRREL_FOLDER = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
DOC_FOLDER = "/mnt/docs"
|
||||
|
||||
STRIP_CHARS = len(DOC_FOLDER) + len("file:///")
|
||||
@ -35,14 +38,14 @@ class Recoll(object):
|
||||
repo = Recoll()
|
||||
|
||||
app = FastAPI()
|
||||
app.mount("/static", StaticFiles(directory="app/static"))
|
||||
app.mount("/static", StaticFiles(directory=f"{SQUIRREL_FOLDER}/app/static"))
|
||||
app.mount("/docs", StaticFiles(directory=DOC_FOLDER))
|
||||
app.mount(
|
||||
"/icons",
|
||||
StaticFiles(directory="/usr/share/icons/breeze/mimetypes/32", follow_symlink=True),
|
||||
)
|
||||
|
||||
templates = Jinja2Templates(directory="app/templates")
|
||||
templates = Jinja2Templates(directory=f"{SQUIRREL_FOLDER}/app/templates")
|
||||
|
||||
|
||||
@app.get("/")
|
||||
|
||||
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Loading…
x
Reference in New Issue
Block a user