-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (42 loc) · 1.51 KB
/
Dockerfile
File metadata and controls
52 lines (42 loc) · 1.51 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
FROM ubuntu:24.04
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
gosu \
python3 \
python3-pip \
python3-venv \
sudo \
vim \
wget \
&& rm -rf /var/lib/apt/lists/*
# Download and install Google Chrome
RUN wget -q -O google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& apt-get update \
&& apt-get install -y ./google-chrome.deb \
&& rm google-chrome.deb
# Create a virtual environment in the user's home directory.
RUN python3 -m venv /opt/venv
# Ensure the virtual environment is used by modifying the PATH.
ENV PATH="/opt/venv/bin:$PATH"
# Install StrictDoc. Set default StrictDoc installation from PyPI but allow
# overriding it with an environment variable.
ARG HTML2PDF4DOC_SOURCE="pypi"
ENV HTML2PDF4DOC_SOURCE=${HTML2PDF4DOC_SOURCE}
RUN if [ "$HTML2PDF4DOC_SOURCE" = "pypi" ]; then \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir html2pdf4doc; \
else \
pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir git+https://github.com/strictdoc-project/html2pdf4doc_python.git@${HTML2PDF4DOC_SOURCE}; \
fi; \
chmod -R 777 /opt/venv;
# Remove the default 'ubuntu' user.
RUN userdel -r ubuntu 2>/dev/null || true
# Allow updating the UID/GID dynamically at runtime
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Set the working directory to the user's home directory.
WORKDIR /data
ENTRYPOINT ["/entrypoint.sh"]