FROM python:3.11-slim WORKDIR /app ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 CUDA_VISIBLE_DEVICES="" \ MATH2LATEX_THREADS=2 MATH2LATEX_MODEL_DIR=/app/artifacts/formulanet RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 && rm -rf /var/lib/apt/lists/* COPY requirements.txt pyproject.toml setup.py ./ RUN pip install --no-cache-dir -r requirements.txt COPY scripts ./scripts RUN pip install --no-cache-dir --no-deps . && python -m image_to_latex.artifacts COPY api ./api RUN useradd --create-home --uid 1000 appuser && chown -R appuser:appuser /app USER appuser EXPOSE 7860 CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]