mirror of
https://github.com/Unstructured-IO/unstructured.git
synced 2025-07-24 09:26:08 +00:00

### Description Currently the CI caches the CI dependencies but uses the hash of all files in `requirements/`. This isn't completely accurate since the ingest dependencies are installed in a later step and don't affect the cached environment. As part of this PR: * ingest dependencies were isolated into their own folder in `requirements/ingest/` * A new cache setup was introduced in the CI to restore the base cache -> install ingest dependencies -> cache it with a new id * new make target created to install all ingest dependencies via `pip install -r ...` * updates to Dockerfile to use `find ...` to install all dependencies, avoiding the need to update this when new deps are added. * update to pip-compile script to run over all `*.in` files in `requirements/`
44 lines
1.4 KiB
Docker
44 lines
1.4 KiB
Docker
# syntax=docker/dockerfile:experimental
|
|
FROM quay.io/unstructured-io/base-images:rocky9.2-5@sha256:1721c3b0711e4e90587e3b4917f1b616e4603ddf5b4986bfaa68d02d82a13aba as base
|
|
|
|
# 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
|
|
ARG PIP_VERSION
|
|
|
|
# Set up environment
|
|
ENV HOME /home/${NB_USER}
|
|
ENV PYTHONPATH="${PYTHONPATH}:${HOME}"
|
|
ENV PATH="/home/usr/.local/bin:${PATH}"
|
|
|
|
RUN groupadd --gid ${NB_UID} ${NB_USER}
|
|
RUN useradd --uid ${NB_UID} --gid ${NB_UID} ${NB_USER}
|
|
WORKDIR ${HOME}
|
|
RUN mkdir ${HOME}/.ssh && chmod go-rwx ${HOME}/.ssh \
|
|
&& ssh-keyscan -t rsa github.com >> ${HOME}/.ssh/known_hosts
|
|
|
|
FROM base as deps
|
|
# Copy and install Unstructured
|
|
COPY requirements requirements
|
|
|
|
RUN python3.10 -m pip install pip==${PIP_VERSION} && \
|
|
dnf -y groupinstall "Development Tools" && \
|
|
find requirements/ -type f -name "*.txt" -exec python3 -m pip install --no-cache -r '{}' ';' && \
|
|
dnf -y groupremove "Development Tools" && \
|
|
dnf clean all
|
|
|
|
RUN python3.10 -c "import nltk; nltk.download('punkt')" && \
|
|
python3.10 -c "import nltk; nltk.download('averaged_perceptron_tagger')"
|
|
|
|
FROM deps as code
|
|
|
|
USER ${NB_USER}
|
|
|
|
COPY example-docs example-docs
|
|
COPY unstructured unstructured
|
|
|
|
RUN python3.10 -c "from unstructured.ingest.pipeline.initialize import initialize; initialize()"
|
|
|
|
CMD ["/bin/bash"]
|