# Dockerfile FROM python:3.10 # Create a non-root user with valid username format RUN adduser --disabled-password --gecos '' professor && \ mkdir -p /app && \ chown -R professor:professor /app # Install system dependencies RUN apt-get update && apt-get upgrade -y # Copy requirements and install COPY requirements.txt /requirements.txt RUN pip install --upgrade pip && \ pip install -r /requirements.txt # Switch to non-root user USER professor WORKDIR /app # Copy application files COPY --chown=professor:professor . . # Set environment variables ENV LOG_PATH=/app/BotLog.txt ENV FLASK_APP=app.py ENV FLASK_DEBUG=0 ENV FLASK_RUN_HOST=0.0.0.0 ENV FLASK_RUN_PORT=7860 # Ensure the log file is writable RUN touch $LOG_PATH && chmod 666 $LOG_PATH # Expose port EXPOSE 7860 # Start Pyrogram bot and Flask app separately CMD ["sh", "-c", "python bot.py & flask run"]