Files
docling-serve/Containerfile
Anil Vishnoi a91ee83c61 Publish docling-serve images to ghcr and quay container repositories (#1)
* Publish docling-serve images to ghcr and quay container repositories

This commit:
- Creates container file to build the image for cpu only
and default "with gpu" images
- Adds workflow jobs to publish the images to ghcr.io and quay.io
- Makefile to build these images locally for linux/amd64 platform.

Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>

* make cpu-only version with poetry

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>

* Rename cpu/gpu image names and also update the supported platforms

Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>

---------

Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
Co-authored-by: Michele Dolfi <dol@zurich.ibm.com>
2024-09-12 22:02:42 +02:00

33 lines
866 B
Docker

FROM python:3.11-slim-bookworm
ARG CPU_ONLY=false
WORKDIR /docling-serve
RUN apt-get update \
&& apt-get install -y libgl1 libglib2.0-0 curl wget git \
&& apt-get clean
RUN pip install --no-cache-dir poetry
COPY pyproject.toml poetry.lock README.md /docling-serve/
RUN if [ "$CPU_ONLY" = "true" ]; then \
poetry install --no-root --with cpu; \
else \
poetry install --no-root; \
fi
ENV HF_HOME=/tmp/
ENV TORCH_HOME=/tmp/
RUN poetry run python -c 'from docling.document_converter import DocumentConverter; artifacts_path = DocumentConverter.download_models_hf(force=True);'
# On container environments, always set a thread budget to avoid undesired thread congestion.
ENV OMP_NUM_THREADS=4
COPY ./docling_serve /docling-serve/docling_serve
EXPOSE 5000
CMD ["poetry", "run", "uvicorn", "--port", "5000", "docling_serve.app:app"]