yeyefowl / Dockerfile
mgbam's picture
Update Dockerfile
1172cbd verified
raw
history blame contribute delete
758 Bytes
# Dockerfile
FROM python:3.10-slim
# Set up a non-root user for security and compatibility with HF Spaces
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
ENV HOME="/home/user"
WORKDIR /app
# Install system dependencies
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
tesseract-ocr \
&& rm -rf /var/lib/apt/lists/*
USER user
# Copy and install Python packages
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the application code
COPY --chown=user . .
# Expose the port required by HF Spaces
EXPOSE 7860
# Run the FastAPI application using Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]