forked from presenton/presenton
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.dev
More file actions
105 lines (92 loc) · 4.96 KB
/
Copy pathDockerfile.dev
File metadata and controls
105 lines (92 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# syntax=docker/dockerfile:1.4
FROM python:3.11-slim-trixie
WORKDIR /app
ARG TARGETARCH
ARG CHROMIUM_VERSION=149.0.7827.196-1~deb13u1
ARG CHROMIUM_SNAPSHOT=20260625T180000Z
# LiteParse (Node + @llamaindex/liteparse) for document extraction; OCR via Tesseract.
ENV APP_DATA_DIRECTORY=/app_data \
TEMP_DIRECTORY=/tmp/presenton \
UV_SYSTEM_PYTHON=1 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
PATH="/root/.local/bin:${PATH}" \
EXPORT_PACKAGE_ROOT=/app/presentation-export \
EXPORT_RUNTIME_DIR=/app/presentation-export \
BUILT_PYTHON_MODULE_PATH=/app/presentation-export/py/convert-linux-current \
PRESENTON_APP_ROOT=/app \
HF_HOME=/root/.cache/huggingface \
PRESENTON_FASTEMBED_ICON_CACHE_DIR=/root/.cache/presenton/fastembed-icons \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
RUN printf 'Acquire::Check-Valid-Until "false";\n' > /etc/apt/apt.conf.d/99snapshot \
&& printf 'deb [check-valid-until=no] http://snapshot.debian.org/archive/debian-security/%s trixie-security main\n' "$CHROMIUM_SNAPSHOT" > /etc/apt/sources.list.d/chromium-snapshot.list \
&& apt-get update && apt-get install -y --no-install-recommends --allow-downgrades \
ca-certificates curl unzip \
nginx fontconfig imagemagick zstd \
fonts-liberation fonts-noto-core fonts-noto-extra fonts-noto-mono fonts-noto-ui-core fonts-noto-ui-extra \
fonts-noto-cjk fonts-noto-cjk-extra fonts-noto-color-emoji xdg-utils \
libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 libatspi2.0-0t64 \
libcairo2 libcups2t64 libdbus-1-3 libdrm2 libexpat1 libgbm1 \
libglib2.0-0t64 libgtk-3-0t64 libnspr4 libnss3 libpango-1.0-0 \
libx11-6 libxcb1 libxcomposite1 libxdamage1 libxext6 libxfixes3 \
libxkbcommon0 libxrandr2 libxshmfence1 libxss1 libxtst6 \
tesseract-ocr tesseract-ocr-eng \
chromium="${CHROMIUM_VERSION}" \
chromium-common="${CHROMIUM_VERSION}" \
chromium-driver="${CHROMIUM_VERSION}" \
&& apt-mark hold chromium chromium-common chromium-driver \
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
&& rm -rf /var/lib/apt/lists/*
# Remove any non-Noto fonts that may have been installed as dependencies.
RUN find /usr/share/fonts -type f ! -iname 'Noto*' -delete \
&& find /usr/share/fonts -type d -empty -delete \
&& fc-cache -fsv
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
COPY package.json package-lock.json /app/
RUN npm --prefix /app install --omit=dev
RUN mkdir -p /app/document-extraction-liteparse \
&& cd /app/document-extraction-liteparse \
&& npm init -y \
&& npm install @llamaindex/liteparse@1.5.2 --omit=dev
COPY electron/resources/document-extraction/liteparse_runner.mjs /app/document-extraction-liteparse/liteparse_runner.mjs
COPY scripts/sync-presentation-export.cjs /app/scripts/sync-presentation-export.cjs
COPY scripts/presenton-terminal-banner.mjs /app/scripts/presenton-terminal-banner.mjs
COPY scripts/user-config-env.cjs /app/scripts/user-config-env.cjs
RUN rm -rf /app/presentation-export \
&& EXPORT_RUNTIME_ARCH="${TARGETARCH}" node /app/scripts/sync-presentation-export.cjs --force \
&& find /app/presentation-export/py -maxdepth 1 -type f -name "convert-linux-*" -exec chmod +x {} \; \
&& set -eux; \
if [ -z "${TARGETARCH:-}" ]; then TARGETARCH="$(dpkg --print-architecture)"; fi; \
case "$TARGETARCH" in \
amd64) export_arch="x64" ;; \
arm64) export_arch="arm64" ;; \
*) echo "Unsupported TARGETARCH: $TARGETARCH" && exit 1 ;; \
esac; \
test -f "/app/presentation-export/py/convert-linux-${export_arch}"; \
ln -sf "/app/presentation-export/py/convert-linux-${export_arch}" /app/presentation-export/py/convert-linux-current; \
chmod +x "/app/presentation-export/py/convert-linux-${export_arch}"; \
ls -lah /app/presentation-export/py
# Bind mount `.:/app` hides any .venv under servers/fastapi at runtime — install deps into
# system site-packages (same interpreter `start.js` uses as `python`).
COPY servers/fastapi /app/servers/fastapi
COPY templates /app/templates
WORKDIR /app/servers/fastapi
RUN --mount=type=cache,target=/root/.cache/uv \
uv export --frozen --no-dev --no-emit-project -o /tmp/requirements.txt \
&& uv pip install --system -r /tmp/requirements.txt \
&& uv pip install --system --no-deps .
# Mem0 BM25 lemmatization requires a spaCy language model at runtime.
# Installing it in the image avoids per-run downloads and startup self-disable.
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system \
"https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.8.0/en_core_web_sm-3.8.0-py3-none-any.whl"
# FastEmbed + Hugging Face Hub weights for icon search and Mem0 (no cache-only mount here:
# those files must remain in the image layer).
WORKDIR /app/servers/fastapi
RUN python scripts/warm_fastembed_cache.py
WORKDIR /app
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["node", "/app/start.js", "--dev"]