BakoAI / Dockerfile
icanedit2's picture
Deploy backend to HF with player video visibility fix
32bc095
Raw
History Blame Contribute Delete
1.23 kB
# Use an official Python runtime as a parent image
FROM python:3.11-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
DEBIAN_FRONTEND=noninteractive
# Set the working directory
WORKDIR /app
# Install system dependencies for OpenCV, PyTesseract, and PDF processing
RUN apt-get update && apt-get install -y \
build-essential \
ffmpeg \
libsm6 \
libxext6 \
poppler-utils \
tesseract-ocr \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user required by Hugging Face Spaces
RUN useradd -m -u 1000 user
# Set the working directory
WORKDIR /app
# Ensure /app is owned by the user so we don't get PermissionError on startup
RUN chown -R user:user /app
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Copy requirements first to leverage Docker cache
COPY --chown=user requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY --chown=user . .
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]