-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.withoutcache
More file actions
59 lines (46 loc) · 2.03 KB
/
Dockerfile.withoutcache
File metadata and controls
59 lines (46 loc) · 2.03 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
# Use the official Debian slim image with python 3.12 as a base (paddlex does not work with python 3.13)
FROM python:3.12-slim
# Update system and Install python3
RUN apt-get update && \
apt-get install -y \
python3-pip \
python3-venv \
python3-opencv \
ccache \
curl \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Change working directory for install purposes
WORKDIR /usr/paddlex/
# Create a virtual environment and install paddlex and dependencies
ENV VIRTUAL_ENV=venv
RUN python3.12 -m venv venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY requirements.txt /usr/paddlex/
RUN pip3 install --no-cache-dir -r requirements.txt
# Download models from web into "models" folder so they are not downloaded for each container run
RUN models_path=/usr/paddlex/models/ ; \
mkdir ${models_path} ; \
for model in PP-DocLayout-L RT-DETR-H_layout_17cls PP-LCNet_x1_0_table_cls RT-DETR-L_wired_table_cell_det RT-DETR-L_wireless_table_cell_det PP-FormulaNet-L; do \
if [ ! -d ${models_path}/${model} ]; then \
curl -o ${models_path}${model}.tar https://paddle-model-ecology.bj.bcebos.com/paddlex/official_inference_model/paddle3.0.0/${model}_infer.tar ; \
tar -xf ${models_path}${model}.tar ; \
mv ${model}_infer ${models_path}${model} ; \
rm ${models_path}${model}.tar ; \
fi ; \
done
# Download fonts from web into "fonts" folder so they are not downloaded for each container run
RUN font_path=/usr/paddlex/venv/lib/python3.12/site-packages/paddlex/utils/fonts/ ; \
for font in PingFang-SC-Regular.ttf simfang.ttf; do \
if [ ! -f ${font_path}${font} ]; then \
curl -o ${font_path}${font} https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/fonts/${font} ; \
fi ; \
done
# Create required folders
RUN mkdir -p /usr/paddlex/output \
&& mkdir -p /data
# Copy config and sources
COPY config.json /usr/paddlex/
COPY src/ /usr/paddlex/src/
ENTRYPOINT ["/usr/paddlex/venv/bin/python3", "/usr/paddlex/src/main.py"]