masx-openchat-llm / Dockerfile
ateetvatan
formatting + removed cpu parralism
e6a07cc
raw
history blame contribute delete
928 Bytes
# ๐Ÿ”น Base image
FROM python:3.10-slim
# ๐Ÿ”น Create Hugging Face-compliant non-root user
RUN useradd -m -u 1000 user
# ๐Ÿ”น Set environment variables
ENV HOME=/home/user
ENV APP_HOME=/home/user/app
ENV HF_HOME=/home/user/.hf_home
# ๐Ÿ”น Set working directory
WORKDIR $APP_HOME
# ๐Ÿ”น Install system dependencies (root)
USER root
RUN apt-get update && apt-get install -y \
git curl \
&& rm -rf /var/lib/apt/lists/*
# ๐Ÿ”น Install Python dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# ๐Ÿ”น Copy app code and give ownership to non-root user
COPY --chown=user:user . .
# ๐Ÿ”น Ensure HF model cache dir is writable
RUN mkdir -p $HF_HOME && chown -R user:user $HF_HOME
# ๐Ÿ”น Switch to non-root user (required by HF Spaces)
USER user
# ๐Ÿ”น Expose the FastAPI port
EXPOSE 7860
# ๐Ÿ”น Start your app
CMD ["python", "app.py"]