ARG BASE_IMAGE=python:3.11-bookworm FROM ${BASE_IMAGE} ARG PIP_INDEX_URL=https://pypi.org/simple ARG TORCH_INDEX_URL=https://download.pytorch.org/whl/cpu ARG TORCH_CPU_VERSION=2.13.0+cpu ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ PIP_NO_CACHE_DIR=1 \ PYTHONPATH=/opt/rag:/opt/rag/src COPY requirements/rag.txt /tmp/requirements.txt RUN python -m pip install --no-cache-dir \ --index-url "$TORCH_INDEX_URL" "torch==$TORCH_CPU_VERSION" \ && python -m pip install --no-cache-dir -r /tmp/requirements.txt \ && rm -f /tmp/requirements.txt COPY work/context/RAG/ /opt/rag/ RUN test -f /opt/rag/.hardened-build.json \ && python -c "import sys; assert sys.version_info[:2] == (3, 11)" \ && python -c "import torch; assert torch.__version__ == '$TORCH_CPU_VERSION'; assert torch.version.cuda is None" \ && test "$(find /opt/rag -type f -name '*.so' | wc -l)" -gt 0 WORKDIR /opt/rag CMD ["python", "-m", "uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "7900", "--workers", "2"]