|
| 1 | +# syntax=docker/dockerfile:experimental |
| 2 | + |
| 3 | +FROM centos:centos7.9.2009 |
| 4 | + |
| 5 | +ARG PIP_VERSION |
| 6 | +ARG UNSTRUCTURED |
| 7 | + |
| 8 | +RUN yum -y update && \ |
| 9 | + yum -y install poppler-utils xz-devel which |
| 10 | + |
| 11 | +# Note(austin) Get a recent tesseract from this repo |
| 12 | +# See https://tesseract-ocr.github.io/tessdoc/Installation.html |
| 13 | +# PDF and images: |
| 14 | +RUN yum-config-manager --add-repo https://download.opensuse.org/repositories/home:/Alexander_Pozdnyakov/CentOS_7/ && \ |
| 15 | + rpm --import https://build.opensuse.org/projects/home:Alexander_Pozdnyakov/public_key && \ |
| 16 | + yum -y update && \ |
| 17 | + yum -y install tesseract |
| 18 | + |
| 19 | +# Note(yuming): Install gcc & g++ ≥ 5.4 for Detectron2 requirement |
| 20 | +RUN yum -y update |
| 21 | +RUN yum -y install centos-release-scl |
| 22 | +RUN yum -y install devtoolset-7-gcc* |
| 23 | +SHELL [ "/usr/bin/scl", "enable", "devtoolset-7"] |
| 24 | + |
| 25 | +RUN yum -y update && \ |
| 26 | + # MS Office docs: |
| 27 | + yum -y install libreoffice && \ |
| 28 | + yum -y install openssl-devel bzip2-devel libffi-devel make git sqlite-devel && \ |
| 29 | + curl -O https://www.python.org/ftp/python/3.8.15/Python-3.8.15.tgz && tar -xzf Python-3.8.15.tgz && \ |
| 30 | + cd Python-3.8.15/ && ./configure --enable-optimizations && make altinstall && \ |
| 31 | + cd .. && rm -rf Python-3.8.15* && \ |
| 32 | + ln -s /usr/local/bin/python3.8 /usr/local/bin/python3 |
| 33 | + |
| 34 | +# create a home directory |
| 35 | +ENV HOME /home/ |
| 36 | + |
| 37 | +WORKDIR ${HOME} |
| 38 | +RUN mkdir ${HOME}/.ssh && chmod go-rwx ${HOME}/.ssh \ |
| 39 | + && ssh-keyscan -t rsa github.com >> /home/.ssh/known_hosts |
| 40 | + |
| 41 | +ENV PYTHONPATH="${PYTHONPATH}:${HOME}" |
| 42 | +ENV PATH="/home/usr/.local/bin:${PATH}" |
| 43 | + |
| 44 | +COPY example-docs example-docs |
| 45 | + |
| 46 | +COPY requirements/base.txt requirements-base.txt |
| 47 | +COPY requirements/huggingface.txt requirements-huggingface.txt |
| 48 | +COPY requirements/dev.txt requirements-dev.txt |
| 49 | +# PDFs and images |
| 50 | +COPY requirements/local-inference.txt requirements-local-inference.txt |
| 51 | + |
| 52 | + |
| 53 | +RUN python3.8 -m pip install pip==${PIP_VERSION} \ |
| 54 | + && pip install --no-cache -r requirements-base.txt \ |
| 55 | + && pip install --no-cache -r requirements-huggingface.txt \ |
| 56 | + && pip install --no-cache -r requirements-dev.txt \ |
| 57 | + # PDFs and images |
| 58 | + && pip install --no-cache -r requirements-local-inference.txt \ |
| 59 | + # PDFs |
| 60 | + && pip install --no-cache "detectron2@git+https://github.com/facebookresearch/[email protected]#egg=detectron2" |
| 61 | + |
| 62 | +COPY unstructured unstructured |
| 63 | + |
| 64 | +CMD ["/bin/bash"] |
0 commit comments