# Use Python slim image for efficiency FROM python:3.10-slim # Set up environment variables ENV PYTHONUNBUFFERED=1 \ PATH="/home/user/.local/bin:$PATH" # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ nodejs \ npm \ && rm -rf /var/lib/apt/lists/* # Install npm package RUN npm install -g youtube-po-token-generator # Create non-root user RUN useradd -m -u 1000 user USER user WORKDIR /app # Install Python dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --user -r requirements.txt # Copy application files COPY --chown=user . . # Expose port EXPOSE 7860 # Run application CMD ["python", "app.py"]