FROM python:3.11


RUN useradd -m -u 1000 user

# Switch to the "user" user
USER user

# Set the working directory to the user's home directory

WORKDIR /code/
RUN chmod -R 777 /code/

RUN pip install --no-cache-dir faiss-cpu langchain-community gradio sentence-transformers

# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user ./app.py /code/app.py
COPY --chown=user ./vectorestore/ /code/vectorstore

ENV GRADIO_SERVER_NAME="0.0.0.0"
EXPOSE 7860

CMD [ "python", "app.py" ]