im2latex / Dockerfile
Samarth Naik
Fix Dockerfile: update OpenGL package name for Debian trixie compatibility
164f30d
# Use Python slim image as base
FROM python:3.11-slim
# Install system dependencies needed for TextTeller and image processing (as root)
RUN apt-get update && apt-get install -y \
git \
wget \
curl \
build-essential \
libgl1-mesa-dev \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libgthread-2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user (required by Hugging Face Spaces)
RUN useradd -m -u 1000 user
USER user
# Set environment PATH
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY --chown=user requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --user -r requirements.txt
# Install TextTeller with ONNX runtime support
RUN pip install --no-cache-dir --user texteller
# Copy the application code
COPY --chown=user main.py .
# Set environment variables
ENV FLASK_APP=main.py
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Expose the port the app runs on
EXPOSE 7860
# Add healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run the application
CMD ["python", "main.py"]