FROM python:3.9 # Install some assorted build and dev libraries ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Europe/Paris RUN apt-get update && apt-get install -y \ vim \ git \ jq \ make build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev # User RUN useradd -m -u 1000 user USER user ENV HOME /home/user ENV PATH $HOME/.local/bin:$PATH WORKDIR $HOME RUN mkdir app WORKDIR $HOME/app # Build llama.cpp (CPU, only `quantize`) # Should we pin a known commit? RUN git clone https://github.com/ggerganov/llama.cpp.git WORKDIR $HOME/app/llama.cpp RUN make quantize WORKDIR $HOME/app # App and Python reqs # Should we pin versions here? COPY --chown=user ./ $HOME/app RUN pip install --no-cache-dir -r requirements.txt ENV PYTHONPATH $HOME/app ENV PYTHONUNBUFFERED 1 ENV GRADIO_ALLOW_FLAGGING never ENV GRADIO_NUM_PORTS 1 ENV GRADIO_SERVER_NAME 0.0.0.0 ENV GRADIO_THEME huggingface ENV SYSTEM spaces CMD ["python", "app.py"]