Echo9k commited on
Commit
7b1dacd
·
verified ·
1 Parent(s): 68b56eb

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -0
Dockerfile ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Ubuntu base image
2
+ FROM ubuntu:22.04
3
+
4
+ # Set environment variables to non-interactive to avoid prompts during installation
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+
7
+ # Update the package list and install necessary packages
8
+ RUN apt-get update && \
9
+ apt-get install -y \
10
+ software-properties-common && \
11
+ add-apt-repository ppa:deadsnakes/ppa && \
12
+ apt-get update && \
13
+ apt-get install -y \
14
+ python3.10 \
15
+ python3.10-venv \
16
+ python3.10-distutils \
17
+ python3-pip \
18
+ wget \
19
+ git \
20
+ libgl1 \
21
+ libreoffice \
22
+ fonts-noto-cjk \
23
+ fonts-wqy-zenhei \
24
+ fonts-wqy-microhei \
25
+ ttf-mscorefonts-installer \
26
+ fontconfig \
27
+ libglib2.0-0 \
28
+ libxrender1 \
29
+ libsm6 \
30
+ libxext6 \
31
+ poppler-utils \
32
+ && rm -rf /var/lib/apt/lists/*
33
+
34
+ # Set Python 3.10 as the default python3
35
+ RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
36
+
37
+ # Create a virtual environment for MinerU
38
+ RUN python3 -m venv /opt/mineru_venv
39
+
40
+ # Copy the configuration file template and install magic-pdf latest
41
+ RUN /bin/bash -c "wget https://github.com/opendatalab/MinerU/raw/master/magic-pdf.template.json && \
42
+ cp magic-pdf.template.json /root/magic-pdf.json && \
43
+ source /opt/mineru_venv/bin/activate && \
44
+ pip3 install --upgrade pip && \
45
+ pip3 install -U magic-pdf[full]"
46
+
47
+ # Download models and update the configuration file
48
+ RUN /bin/bash -c "pip3 install huggingface_hub && \
49
+ wget https://github.com/opendatalab/MinerU/raw/master/scripts/download_models_hf.py -O download_models.py && \
50
+ python3 download_models.py && \
51
+ sed -i 's|cpu|cuda|g' /root/magic-pdf.json"
52
+
53
+ # Set the entry point to activate the virtual environment and run the command line tool
54
+ ENTRYPOINT ["/bin/bash", "-c", "source /opt/mineru_venv/bin/activate && exec \"$@\"", "--"]