FROM python:3.9 # Create non-root user RUN useradd -m -u 1000 user WORKDIR /app # Copy requirements first for better caching COPY --chown=user ./requirements.txt requirements.txt # Install dependencies RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy application files COPY --chown=user . /app # Switch to non-root user USER user # Set environment variables ENV PYTHONUNBUFFERED=1 ENV PYSCOUT_MODE=api ENV HOST=0.0.0.0 ENV PORT=7860 # Run the application ENTRYPOINT ["python", "docker_entrypoint.py"]