Spaces:
Sleeping
Sleeping
File size: 864 Bytes
2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e 2e52237 6f19a4e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Dockerfile for Hugging Face Spaces - TinyLlama + ctransformers
FROM python:3.10-slim
# Install system packages for ctransformers build
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential cmake git libclang-dev libssl-dev pkg-config && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user (Spaces uses UID 1000)
RUN useradd -m -u 1000 user
# Create app directory & make sure non-root user can write
WORKDIR /app
RUN mkdir -p /home/user/model_cache && chown -R user:user /home/user
# Copy requirements and install
COPY --chown=user:user requirements.txt /app/requirements.txt
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Copy app files
COPY --chown=user:user . /app
# Switch to non-root user
USER user
# Expose Gradio port
EXPOSE 7860
# Run app
CMD ["python", "app.py"]
|