# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

FROM python:3.11-slim

ARG ARCH="cpu"

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
    iputils-ping \
    libgl1-mesa-glx \
    libjemalloc-dev

RUN useradd -m -s /bin/bash user && \
    mkdir -p /home/user && \
    chown -R user /home/user/

COPY comps /home/user/comps

USER user
RUN pip install --no-cache-dir --upgrade pip setuptools && \
    if [ ${ARCH} = "cpu" ]; then pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu; fi && \
    pip install --no-cache-dir -r /home/user/comps/retrievers/vdms/langchain/requirements.txt

RUN pip install --no-cache-dir -U \
    huggingface-hub \
    langchain \
    langchain-community

ENV PYTHONPATH=$PYTHONPATH:/home/user

ENV HUGGINGFACEHUB_API_TOKEN=dummy

ENV USECLIP 0

WORKDIR /home/user/comps/retrievers/vdms/langchain

ENTRYPOINT ["python", "retriever_vdms.py"]
