Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ RUN apt-get update \

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
ENV NLTK_DATA=/app/nltk_data

# Download standard NLTK data, to prevent unstructured from downloading packages at runtime
RUN python -m nltk.downloader -d /app/nltk_data punkt_tab averaged_perceptron_tagger averaged_perceptron_tagger_eng
ENV NLTK_DATA=/app/nltk_data
RUN python -m nltk.downloader --exit-on-error -d /app/nltk_data punkt_tab averaged_perceptron_tagger averaged_perceptron_tagger_eng

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make NLTK download failures fail the image build

When any NLTK package cannot be fetched or resolved, --exit-on-error does not make python -m nltk.downloader return a non-zero status; I checked the NLTK CLI source and this option only sets halt_on_error, then the main loop breaks on rv == False without calling sys.exit, so Docker will still continue and can publish an image missing the required data. Please wrap this in a Python one-liner that exits based on nltk.download(...) results or otherwise force a non-zero status; the same command is present in Dockerfile.lite.

Useful? React with 👍 / 👎.


# Disable Unstructured analytics
ENV SCARF_NO_ANALYTICS=true
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.lite
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ RUN apt-get update \

COPY requirements.lite.txt .
RUN pip install --no-cache-dir -r requirements.lite.txt
ENV NLTK_DATA=/app/nltk_data

# Download standard NLTK data, to prevent unstructured from downloading packages at runtime
RUN python -m nltk.downloader -d /app/nltk_data punkt_tab averaged_perceptron_tagger averaged_perceptron_tagger_eng
ENV NLTK_DATA=/app/nltk_data
RUN python -m nltk.downloader --exit-on-error -d /app/nltk_data punkt_tab averaged_perceptron_tagger averaged_perceptron_tagger_eng

# Disable Unstructured analytics
ENV SCARF_NO_ANALYTICS=true
Expand Down
Loading