Repository navigation
Expand file tree
/
Copy pathDockerfile.watermark
More file actions
64 lines (55 loc) · 2.31 KB
/
Copy pathDockerfile.watermark
File metadata and controls
64 lines (55 loc) · 2.31 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
FROM python:3.10-slim
LABEL maintainer="OpenVela Team"
LABEL description="Watermark detection tool for CI/CD pipelines"
# Set environment variables to avoid interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
libgthread-2.0-0 \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir \
opencv-python-headless==4.8.1.78 \
numpy==1.24.3 \
paddlepaddle==2.6.2 \
paddleocr==2.7.3
# Pre-download PaddleOCR models to avoid first-run download
# This significantly speeds up the first detection
RUN mkdir -p /root/.paddleocr/whl/det/en/en_PP-OCRv3_det_infer && \
mkdir -p /root/.paddleocr/whl/rec/en/en_PP-OCRv4_rec_infer && \
mkdir -p /root/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer && \
# Download and extract detection model
cd /root/.paddleocr/whl/det/en/en_PP-OCRv3_det_infer && \
wget -q https://paddleocr.bj.bcebos.com/PP-OCRv3/english/en_PP-OCRv3_det_infer.tar && \
tar -xf en_PP-OCRv3_det_infer.tar --strip-components=1 && \
rm en_PP-OCRv3_det_infer.tar && \
# Download and extract recognition model (v4)
cd /root/.paddleocr/whl/rec/en/en_PP-OCRv4_rec_infer && \
wget -q https://paddleocr.bj.bcebos.com/PP-OCRv4/english/en_PP-OCRv4_rec_infer.tar && \
tar -xf en_PP-OCRv4_rec_infer.tar --strip-components=1 && \
rm en_PP-OCRv4_rec_infer.tar && \
# Download and extract angle classification model
cd /root/.paddleocr/whl/cls/ch_ppocr_mobile_v2.0_cls_infer && \
wget -q https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar && \
tar -xf ch_ppocr_mobile_v2.0_cls_infer.tar --strip-components=1 && \
rm ch_ppocr_mobile_v2.0_cls_infer.tar
# Copy the watermark detection script
COPY detect_watermark.py /usr/local/bin/detect_watermark.py
RUN chmod +x /usr/local/bin/detect_watermark.py
# Create python symlink for compatibility
RUN ln -s /usr/bin/python3 /usr/bin/python
# Set working directory
WORKDIR /workspace
# Set entrypoint
ENTRYPOINT ["python", "/usr/local/bin/detect_watermark.py"]