forked from gramps-project/gramps-web-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.base
More file actions
111 lines (98 loc) · 3.41 KB
/
Dockerfile.base
File metadata and controls
111 lines (98 loc) · 3.41 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
106
107
108
109
110
111
FROM debian:bookworm
ENV DEBIAN_FRONTEND=noninteractive
ENV GRAMPS_VERSION=60
WORKDIR /app
ENV PYTHONPATH="/usr/lib/python3/dist-packages"
# install poppler (needed for PDF thumbnails)
# ffmpeg (needed for video thumbnails)
# postgresql client (needed for PostgreSQL backend)
RUN apt-get update && apt-get install -y \
appstream pkg-config libcairo2-dev \
gir1.2-gtk-3.0 libgirepository1.0-dev libicu-dev \
graphviz gir1.2-gexiv2-0.10 gir1.2-osmgpsmap-1.0 \
locales gettext wget python3-pip python3-pil \
poppler-utils ffmpeg libavcodec-extra \
unzip \
libpq-dev postgresql-client postgresql-client-common python3-psycopg2 \
libgl1-mesa-dev libgtk2.0-dev libatlas-base-dev \
tesseract-ocr \
tesseract-ocr-ara \
tesseract-ocr-bul \
tesseract-ocr-bre \
tesseract-ocr-cat \
tesseract-ocr-ces \
tesseract-ocr-dan \
tesseract-ocr-deu \
tesseract-ocr-ell \
tesseract-ocr-eng \
tesseract-ocr-epo \
tesseract-ocr-spa \
tesseract-ocr-fin \
tesseract-ocr-fra \
tesseract-ocr-gle \
tesseract-ocr-heb \
tesseract-ocr-hrv \
tesseract-ocr-hun \
tesseract-ocr-isl \
tesseract-ocr-ind \
tesseract-ocr-ita \
tesseract-ocr-jpn \
tesseract-ocr-kor \
tesseract-ocr-lit \
tesseract-ocr-lav \
tesseract-ocr-mkd \
tesseract-ocr-nor \
tesseract-ocr-nld \
tesseract-ocr-pol \
tesseract-ocr-por \
tesseract-ocr-ron \
tesseract-ocr-rus \
tesseract-ocr-slk \
tesseract-ocr-slv \
tesseract-ocr-sqi \
tesseract-ocr-srp \
tesseract-ocr-swe \
tesseract-ocr-tam \
tesseract-ocr-tur \
tesseract-ocr-ukr \
tesseract-ocr-vie \
tesseract-ocr-chi-sim \
tesseract-ocr-chi-tra \
libopenblas-dev cmake \
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
&& rm -rf /var/lib/apt/lists/*
# set locale
RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LANGUAGE=en_US.utf8
ENV LANG=en_US.utf8
ENV LC_ALL=en_US.utf8
# limit pytorch to 1 thread
ENV OMP_NUM_THREADS=1
# install wheel first to enable binary packages for all pip installs
RUN python3 -m pip install --break-system-packages --no-cache-dir wheel
# install gunicorn
RUN python3 -m pip install --break-system-packages --no-cache-dir \
gunicorn
# Install PyICU (slow to compile on ARM, so pre-install in base image)
RUN python3 -m pip install --break-system-packages --no-cache-dir \
PyICU
# Install PyTorch and opencv
RUN python3 -m pip install --break-system-packages --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch
RUN python3 -m pip install --break-system-packages --no-cache-dir \
opencv-python opencv-contrib-python
# Install AI dependencies
RUN python3 -m pip install --break-system-packages --no-cache-dir \
'sentence-transformers>=4.1.0' \
'accelerate' \
'pydantic-ai[openai]>=1.0.0,<2.0.0'
# download and cache sentence transformer model
RUN python3 -c "from sentence_transformers import SentenceTransformer; \
model = SentenceTransformer('sentence-transformers/distiluse-base-multilingual-cased-v2');"
# install Gramps addons
RUN mkdir -p /root/gramps/gramps$GRAMPS_VERSION/plugins && \
wget https://github.com/gramps-project/addons/archive/refs/heads/master.zip && \
for addon in PostgreSQL SharedPostgreSQL FilterRules JSON; do \
unzip -p master.zip addons-master/gramps$GRAMPS_VERSION/download/$addon.addon.tgz | \
tar -xvz -C /root/gramps/gramps$GRAMPS_VERSION/plugins; \
done && \
rm master.zip