Marathi_OCR / Dockerfile
OakMajesty's picture
Update Dockerfile
1b1cb6c verified
FROM python:3.11-slim
# metadata
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install runtime system deps (tesseract + libs for opencv)
# Added 'tesseract-ocr-eng' to ensure English data is present
RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \
tesseract-ocr-mar \
tesseract-ocr-eng \
libsm6 libxext6 libxrender-dev libgl1 \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install (keep this before copying entire repo to leverage cache)
COPY requirements.txt /app/requirements.txt
# If you expect to install torch from wheels, pip can handle it; add --no-cache-dir to reduce image size
RUN pip install --no-cache-dir -r /app/requirements.txt
# Copy the app
COPY . /app
# Create and drop to a non-root user
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
# Expose HF Spaces expected port
EXPOSE 7860
# Start uvicorn on port 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1", "--log-level", "info"]