-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update prompt * test and fix. Add dockerfile.dev * up
- Loading branch information
1 parent
772eb93
commit d762261
Showing
6 changed files
with
90 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM python:3.10-slim AS builder | ||
# Install system dependencies (including those needed for Unstructured and OpenCV) | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
gcc g++ musl-dev curl libffi-dev gfortran libopenblas-dev \ | ||
tesseract-ocr libtesseract-dev libleptonica-dev pkg-config \ | ||
poppler-utils libmagic1 \ | ||
libgl1-mesa-glx libglib2.0-0 \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip install --no-cache-dir poetry | ||
|
||
RUN mkdir -p /app/py | ||
WORKDIR /app/py | ||
COPY pyproject.toml /app/py/pyproject.toml | ||
|
||
# Install the dependencies, including gunicorn, uvicorn, and unstructured | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --extras "core" --no-dev --no-root \ | ||
&& pip install --no-cache-dir gunicorn uvicorn | ||
# Create the final image | ||
FROM python:3.10-slim | ||
# Install runtime dependencies | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
curl tesseract-ocr poppler-utils libmagic1 \ | ||
libgl1-mesa-glx libglib2.0-0 \ | ||
&& apt-get clean && rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages | ||
COPY --from=builder /usr/local/bin /usr/local/bin | ||
|
||
RUN python -c "from unstructured.partition.model_init import initialize; initialize()" | ||
|
||
|
||
# Expose the port and set environment variables | ||
ARG PORT=8000 HOST=0.0.0.0 | ||
ENV PORT=$PORT HOST=$HOST TESSDATA_PREFIX=/usr/share/tesseract-ocr/5/tessdata | ||
EXPOSE $PORT | ||
|
||
COPY . /app | ||
# Copy the application and config | ||
COPY core /app/core | ||
COPY r2r /app/r2r | ||
COPY r2r.toml /app/r2r.toml | ||
COPY pyproject.toml /app/pyproject.toml | ||
|
||
CMD ["sh", "-c", "uvicorn core.main.app_entry:app --host $HOST --port $PORT"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters