2023-03-14 13:40:01 -07:00
|
|
|
# syntax=docker/dockerfile:experimental
|
2024-01-18 17:34:43 -05:00
|
|
|
FROM quay.io/unstructured-io/base-images:rocky9.2-9@sha256:73d8492452f086144d4b92b7931aa04719f085c74d16cae81e8826ef873729c9 as base
|
2023-03-14 13:40:01 -07:00
|
|
|
|
2023-08-29 18:01:44 -07:00
|
|
|
# NOTE(crag): NB_USER ARG for mybinder.org compat:
|
|
|
|
# https://mybinder.readthedocs.io/en/latest/tutorials/dockerfile.html
|
|
|
|
ARG NB_USER=notebook-user
|
|
|
|
ARG NB_UID=1000
|
2023-03-14 13:40:01 -07:00
|
|
|
ARG PIP_VERSION
|
|
|
|
|
2023-05-05 17:16:28 -07:00
|
|
|
# Set up environment
|
2023-08-29 18:01:44 -07:00
|
|
|
ENV HOME /home/${NB_USER}
|
2023-03-14 13:40:01 -07:00
|
|
|
ENV PYTHONPATH="${PYTHONPATH}:${HOME}"
|
|
|
|
ENV PATH="/home/usr/.local/bin:${PATH}"
|
|
|
|
|
2023-08-29 18:01:44 -07:00
|
|
|
RUN groupadd --gid ${NB_UID} ${NB_USER}
|
|
|
|
RUN useradd --uid ${NB_UID} --gid ${NB_UID} ${NB_USER}
|
|
|
|
WORKDIR ${HOME}
|
|
|
|
|
2023-06-21 13:12:45 -04:00
|
|
|
FROM base as deps
|
2023-03-29 00:02:39 -07:00
|
|
|
# Copy and install Unstructured
|
|
|
|
COPY requirements requirements
|
2023-03-14 13:40:01 -07:00
|
|
|
|
2023-08-27 18:30:17 -07:00
|
|
|
RUN python3.10 -m pip install pip==${PIP_VERSION} && \
|
2023-06-01 12:16:04 -07:00
|
|
|
dnf -y groupinstall "Development Tools" && \
|
2023-10-24 10:54:00 -04:00
|
|
|
find requirements/ -type f -name "*.txt" -exec python3 -m pip install --no-cache -r '{}' ';' && \
|
2023-06-01 12:16:04 -07:00
|
|
|
dnf -y groupremove "Development Tools" && \
|
|
|
|
dnf clean all
|
2023-03-14 13:40:01 -07:00
|
|
|
|
2023-08-27 18:30:17 -07:00
|
|
|
RUN python3.10 -c "import nltk; nltk.download('punkt')" && \
|
|
|
|
python3.10 -c "import nltk; nltk.download('averaged_perceptron_tagger')"
|
2023-06-21 13:12:45 -04:00
|
|
|
|
|
|
|
FROM deps as code
|
|
|
|
|
2023-08-29 18:01:44 -07:00
|
|
|
USER ${NB_USER}
|
|
|
|
|
2023-03-29 00:02:39 -07:00
|
|
|
COPY example-docs example-docs
|
2023-03-14 13:40:01 -07:00
|
|
|
COPY unstructured unstructured
|
|
|
|
|
2023-11-17 00:53:25 -05:00
|
|
|
RUN python3.10 -c "from unstructured.partition.model_init import initialize; initialize()"
|
2023-03-29 20:48:06 -07:00
|
|
|
|
2023-03-14 13:40:01 -07:00
|
|
|
CMD ["/bin/bash"]
|