FROM python:3.9-slim WORKDIR /app COPY . . # Install system dependencies RUN apt-get update && apt-get install -y \ libgl1 \ && rm -rf /var/lib/apt/lists/* # Configure Numba cache ENV NUMBA_CACHE_DIR=/tmp/numba_cache RUN mkdir -p ${NUMBA_CACHE_DIR} && chmod 777 ${NUMBA_CACHE_DIR} # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Create non-root user and set permissions RUN useradd -m appuser && \ chown -R appuser /app && \ chown -R appuser ${NUMBA_CACHE_DIR} USER appuser CMD ["python", "app.py"]