MEPLIFEOS / Dockerfile
fugthchat's picture
Update Dockerfile
5681148 verified
Raw History Blame Contribute Delete
987 Bytes
FROM python:3.11-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
HF_HOME=/data/hf \
MODEL_DIR=/data/models \
PORT=7860
# No build-essential/cmake: using pre-built llama-cpp-python CPU wheels.
# Only install a wheel; fail fast rather than compiling on a 2-vCPU Space.
RUN apt-get update && apt-get install -y --no-install-recommends \
libgomp1 ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt ./
RUN python -m pip install --upgrade pip \
&& python -m pip install --only-binary=llama-cpp-python \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu \
-r requirements.txt
COPY app.py index.html ./
RUN useradd -m -u 1000 user \
&& mkdir -p /data/models /data/hf \
&& chown -R user:user /data /app
USER user
EXPOSE 7860
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--no-access-log"]