-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (61 loc) · 2.85 KB
/
Copy pathDockerfile
File metadata and controls
70 lines (61 loc) · 2.85 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
FROM ghcr.io/trueforge-org/python-node:3.14.6@sha256:4c5a5c1d47678e3ca832d02d7b9573de6b2b1ded46a0b3b13a0fa9c2762d7f31
ARG VERSION
ARG TARGETARCH
USER root
ENV PYTHONUNBUFFERED=1
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cargo \
libjpeg-dev \
libffi-dev \
libxslt1-dev \
libssl-dev \
zip \
python3-venv \
zlib1g-dev \
file \
libjpeg-turbo8 \
libxslt1.1 \
poppler-utils && \
echo "**** install changedetection.io ****" && \
mkdir -p /app/changedetection && \
(curl -fsL -o \
/tmp/changedetection.tar.gz \
"https://github.com/dgtlmoon/changedetection.io/archive/refs/tags/${VERSION}.tar.gz" || curl -fsL -o \
/tmp/changedetection.tar.gz \
"https://github.com/dgtlmoon/changedetection.io/archive/refs/tags/v${VERSION#v}.tar.gz") && \
tar xf \
/tmp/changedetection.tar.gz -C \
/app/changedetection/ --strip-components=1 && \
rm /tmp/changedetection.tar.gz && \
/app/venv/bin/pip install -U --no-cache-dir \
pip \
setuptools \
wheel && \
/app/venv/bin/pip install -U --no-cache-dir -r /app/changedetection/requirements.txt && \
PLAYWRIGHT_PY_RELEASE=$(curl -sX GET "https://api.github.com/repos/microsoft/playwright-python/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
if [ -n "${PLAYWRIGHT_PY_RELEASE}" ]; then git clone --depth 1 --branch "${PLAYWRIGHT_PY_RELEASE}" https://github.com/microsoft/playwright-python /tmp/playwright-python; else git clone --depth 1 https://github.com/microsoft/playwright-python /tmp/playwright-python; fi && \
cd /tmp/playwright-python && \
/app/venv/bin/pip install -U --no-cache-dir . && \
PLAYWRIGHT_NODE=$(find /app/venv/lib -path '*/site-packages/playwright/driver/node' | head -n1) && \
if [ -n "${PLAYWRIGHT_NODE}" ]; then rm -f "${PLAYWRIGHT_NODE}" && ln -s /usr/bin/node "${PLAYWRIGHT_NODE}"; fi && \
# Force UTF-8 encoding for browser steps to prevent exception
if [ -f /app/changedetection/changedetectionio/blueprint/browser_steps/browser_steps.py ]; then sed -i "s|xpath_element_js = importlib.resources.files(\\\"changedetectionio.content_fetchers.res\\\").joinpath('xpath_element_scraper.js').read_text()|xpath_element_js = importlib.resources.files(\\\"changedetectionio.content_fetchers.res\\\").joinpath('xpath_element_scraper.js').read_text(encoding='utf-8')|" /app/changedetection/changedetectionio/blueprint/browser_steps/browser_steps.py; fi && \
echo "**** cleanup ****" && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
build-essential cargo libjpeg-dev libffi-dev libxslt1-dev libssl-dev zip zlib1g-dev && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf \
/tmp/* \
$HOME/.cache \
$HOME/.npm \
/var/lib/apt/lists/*
USER apps
COPY --chmod=0755 . /
EXPOSE 5000
VOLUME /config
WORKDIR /config