feat(api): Add pdfkit to requirements, wkhtml2pdf to Dockerfile
This commit is contained in:
+13
-3
@@ -13,13 +13,23 @@ FROM python:3.10-slim
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install git
|
# Install git, wkhtmltopdf (https://raw.githubusercontent.com/JazzCore/python-pdfkit/b7bf798b946fa5655f8e82f0d80dec6b6b13d414/ci/before-script.sh)
|
||||||
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
RUN apt update
|
||||||
|
|
||||||
|
RUN apt install -y git
|
||||||
|
|
||||||
|
ENV WKHTML2PDF_VERSION='0.12.6-1'
|
||||||
|
RUN apt install -y build-essential xorg libssl-dev libxrender-dev wget
|
||||||
|
RUN wget "https://github.com/wkhtmltopdf/packaging/releases/download/${WKHTML2PDF_VERSION}/wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb"
|
||||||
|
RUN sudo apt install -y ./wkhtmltox_${WKHTML2PDF_VERSION}.bionic_amd64.deb
|
||||||
|
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# --- #
|
||||||
|
|
||||||
COPY src/api/requirements.txt requirements.txt
|
COPY src/api/requirements.txt requirements.txt
|
||||||
RUN pip3 install -r requirements.txt
|
RUN pip3 install -r requirements.txt
|
||||||
COPY --from=0 /build/build /app/build
|
COPY --from=0 /build/build /app/build
|
||||||
# COPY src/api/src/.env .env
|
|
||||||
COPY src/api/src .
|
COPY src/api/src .
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ dependencies = [
|
|||||||
"aiohttp-client-cache[all]",
|
"aiohttp-client-cache[all]",
|
||||||
"bs4>=0.0.2",
|
"bs4>=0.0.2",
|
||||||
"uvicorn>=0.32.1",
|
"uvicorn>=0.32.1",
|
||||||
|
"pdfkit>=1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
|
|||||||
Generated
+11
@@ -220,6 +220,7 @@ dependencies = [
|
|||||||
{ name = "ebooklib" },
|
{ name = "ebooklib" },
|
||||||
{ name = "eliot" },
|
{ name = "eliot" },
|
||||||
{ name = "fastapi" },
|
{ name = "fastapi" },
|
||||||
|
{ name = "pdfkit" },
|
||||||
{ name = "pydantic-settings" },
|
{ name = "pydantic-settings" },
|
||||||
{ name = "python-dotenv" },
|
{ name = "python-dotenv" },
|
||||||
{ name = "rich" },
|
{ name = "rich" },
|
||||||
@@ -236,6 +237,7 @@ requires-dist = [
|
|||||||
{ name = "ebooklib", specifier = ">=0.18" },
|
{ name = "ebooklib", specifier = ">=0.18" },
|
||||||
{ name = "eliot", specifier = ">=1.16.0" },
|
{ name = "eliot", specifier = ">=1.16.0" },
|
||||||
{ name = "fastapi", specifier = ">=0.115.5" },
|
{ name = "fastapi", specifier = ">=0.115.5" },
|
||||||
|
{ name = "pdfkit", specifier = ">=1.0.0" },
|
||||||
{ name = "pydantic-settings", specifier = ">=2.6.1" },
|
{ name = "pydantic-settings", specifier = ">=2.6.1" },
|
||||||
{ name = "python-dotenv", specifier = ">=1.0.1" },
|
{ name = "python-dotenv", specifier = ">=1.0.1" },
|
||||||
{ name = "rich", specifier = ">=13.9.4" },
|
{ name = "rich", specifier = ">=13.9.4" },
|
||||||
@@ -708,6 +710,15 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/6a/05/7d768fa3ca23c9b3e1e09117abeded1501119f1d8de0ab722938c91ab25d/orjson-3.10.12-cp313-none-win_amd64.whl", hash = "sha256:229994d0c376d5bdc91d92b3c9e6be2f1fbabd4cc1b59daae1443a46ee5e9825", size = 134944 },
|
{ url = "https://files.pythonhosted.org/packages/6a/05/7d768fa3ca23c9b3e1e09117abeded1501119f1d8de0ab722938c91ab25d/orjson-3.10.12-cp313-none-win_amd64.whl", hash = "sha256:229994d0c376d5bdc91d92b3c9e6be2f1fbabd4cc1b59daae1443a46ee5e9825", size = 134944 },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pdfkit"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/58/bb/6ddc62b4622776a6514fd749041c2b4bccd343e006d00de590f8090ac8b1/pdfkit-1.0.0.tar.gz", hash = "sha256:992f821e1e18fc8a0e701ecae24b51a2d598296a180caee0a24c0af181da02a9", size = 13288 }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/64/1b/26c080096dd93936dccfd32c682bed3d5630a84aae9d493ff68afb2ae0fb/pdfkit-1.0.0-py3-none-any.whl", hash = "sha256:a7a4ca0d978e44fa8310c4909f087052430a6e8e0b1dd7ceef657f139789f96f", size = 12099 },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "propcache"
|
name = "propcache"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user