Files
baserow/embeddings/Dockerfile
Bram 8e797da4f7 feat: [4/5] GPU variant for the embeddings (#6524)
* Added embeddings GPU variant

* Fixed feedback
2026-11-12 13:24:51 +01:00

35 lines
1.1 KiB
Docker

FROM python:3.14.8-slim-trixie AS builder
WORKDIR /build
COPY requirements.txt _download_model.py ./
RUN pip install --no-cache-dir --root-user-action=ignore \
-c requirements.txt huggingface_hub==2.2.0 tokenizers && \
python _download_model.py && \
rm _download_model.py
FROM python:3.14.8-slim-trixie
COPY --from=builder /model /model
RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# requirements-gpu.txt builds the GPU image.
ARG REQUIREMENTS=requirements.txt
COPY ${REQUIREMENTS} requirements.txt
# Nothing installs packages at runtime, so pip only adds CVEs.
RUN pip install --no-cache-dir --root-user-action=ignore --no-deps \
-r requirements.txt && \
pip uninstall -y --root-user-action=ignore pip && \
rm -rf /root/.cache
COPY app.py .
# --no-deps can't catch a missing dependency, so fail the build instead of startup.
# There's no GPU while building, but the CUDA libraries can be loaded.
RUN EMBEDDINGS_DEVICE=cpu python -B -c "import app; app.load_cuda_libraries()"
EXPOSE 80
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "80"]