ai-worker / Dockerfile
dead031's picture
Update Dockerfile
ad87ec1 verified
raw
history blame contribute delete
915 Bytes
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-mar \
tesseract-ocr-hin \
poppler-utils \
libgl1 \
libglx-mesa0 \
libglib2.0-0 \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY requirements.txt .
# Install Torch for CPU first (to avoid dependency issues with detectron2)
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# Install Detectron2 with CPU flags
RUN FORCE_CUDA=0 pip install --no-cache-dir 'git+https://github.com/facebookresearch/detectron2.git'
# Install the rest of the requirements
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Hugging Face Spaces uses user 1000
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
CMD ["python", "app.py"]