-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
140 lines (119 loc) · 4.32 KB
/
Dockerfile
File metadata and controls
140 lines (119 loc) · 4.32 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
ENV DRAWIO_VERSION=26.0.9
# Set the working directory
WORKDIR /app
# Install system dependencies for WeasyPrint and Draw.io
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libcairo2 \
libgdk-pixbuf2.0-0 \
libffi-dev \
shared-mime-info \
libjpeg-turbo8 \
libpng-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
libfontconfig1 \
libharfbuzz-dev \
libfribidi-dev \
libglib2.0-0 \
libmagic1 \
fontconfig \
fonts-dejavu \
openjdk-17-jre-headless \
plantuml \
wget \
unzip \
xvfb \
dbus \
dbus-x11 \
libgtk-3-0 \
libxtst6 \
libnss3 \
libasound2t64 \
libxss1 \
libgbm1 \
ca-certificates \
libnotify4 \
xdg-utils \
libsecret-1-0 \
graphviz \
&& apt-get clean
# Install Python and pip
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv && apt-get clean
# Create a virtual environment
RUN python3 -m venv /venv
# Activate the virtual environment and install dependencies
RUN printf "pydyf==0.10.0\nweasyprint==62.3\n" > /tmp/pip-constraints.txt
RUN /venv/bin/pip install --no-cache-dir -c /tmp/pip-constraints.txt mkdocs==1.2.4 \
mkdocs-izsam-search==0.1.9 \
mkdocs-bioinformatic-izsam-theme==1.0.14 \
mkdocs-izsam-video==1.0.3 \
mkdocs-redirects==1.2.0 \
mkdocs-exclude==1.0.2 \
mkdocs-izsam-mermaid-to-images==1.0.8 \
mkdocs-macros-plugin==1.3.7 \
plantuml-markdown==3.5.2 \
pymdown-extensions==10.9 \
pygments==2.12.0 \
mkdocs-with-pdf==0.9.3 \
qrcode==7.3.1 \
weasyprint==62.3 \
pydyf==0.10.0 \
filelock==3.17.0
# Ensure the virtual environment is activated when running commands
ENV PATH="/venv/bin:$PATH"
# Copy the bin folder (including sh directory) into the Docker image
COPY . /app
# Install custom plugins
RUN /venv/bin/pip install -e /app/plugins/custom
# Set the working directory back to /app
WORKDIR /app
# Detect architecture and install the correct version of Pandoc
RUN apt-get update && \
apt-get install -y wget && \
apt-get clean && \
wget https://github.com/jgm/pandoc/releases/download/2.5/pandoc-2.5-linux.tar.gz && \
tar xvfz pandoc-2.5-linux.tar.gz && \
mv pandoc-2.5/bin/pandoc /usr/local/bin/ && \
mv pandoc-2.5/bin/pandoc-citeproc /usr/local/bin/ && \
rm -rf pandoc-2.5 pandoc-2.5-linux.tar.gz
# Install pandoc-plantuml filter
RUN /venv/bin/pip install --no-cache-dir -c /tmp/pip-constraints.txt pandoc-plantuml-filter && \
ln -s /venv/bin/pandoc-plantuml /usr/local/bin/pandoc-plantuml
# Ensure pinned PDF stack versions after all installs
RUN /venv/bin/pip install --no-cache-dir --force-reinstall --no-deps pydyf==0.10.0
# Install draw.io
RUN wget -q https://github.com/jgraph/drawio-desktop/releases/download/v${DRAWIO_VERSION}/drawio-amd64-${DRAWIO_VERSION}.deb && \
dpkg -i drawio-amd64-${DRAWIO_VERSION}.deb || apt-get -f install -y && \
rm -f drawio-amd64-${DRAWIO_VERSION}.deb
# Copy draw.io conversion script
COPY bin/sh/drawio-converter.sh /usr/local/bin/drawio-converter
# Ensure it is executable
RUN chmod +x /usr/local/bin/drawio-converter
# Ensure the entrypoint.sh file has the correct permissions to be executed
RUN chmod +x /app/entrypoint.sh
# Create the fonts and cache directories
RUN echo '<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"><fontconfig><dir>/wiki/fonts</dir><cachedir>/wiki/cache</cachedir></fontconfig>' > /etc/fonts/fonts.conf
# Solve the issue with the use of custom theme packages with mkdocs-with-pdf
RUN mkdir -p /venv/lib/python3.12/site-packages/mkdocs_with_pdf/themes
RUN cp -r /venv/lib/python3.12/site-packages/bioinformatic_izsam_theme /venv/lib/python3.12/site-packages/mkdocs_with_pdf/themes/bioinformatic_izsam_theme
RUN echo "\
import re\n\
def inject_link(output_content, pdf_path):\n\
return output_content\n\
\n\
def get_stylesheet(debug_html):\n\
return \"\"\n\
" >> /venv/lib/python3.12/site-packages/mkdocs_with_pdf/themes/bioinformatic_izsam_theme/__init__.py
# Set execute permissions only for .sh and .pl files
RUN find /app/bin -type f \( -name "*.sh" \) -exec chmod +x {} \;
# Expose the application port
EXPOSE 8000
# Set the entrypoint to the shell script
ENTRYPOINT ["/app/entrypoint.sh"]