documents_classifyer / Dockerfile
jmparejaz's picture
fix: proper user permissions for HuggingFace Spaces
9df6af9 verified
raw
history blame contribute delete
814 Bytes
FROM python:3.11-slim
# Install system dependencies including Tesseract OCR
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-spa \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Set up user (required by HuggingFace Spaces)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy requirements and install dependencies
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user app.py .
# Expose port for Gradio
EXPOSE 7860
# Set environment variables
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
# Run the application
CMD ["python", "app.py"]