# Starting from an official Python image FROM python:3.9 # Creating a non-root user for security RUN useradd -m -u 1000 user USER user # Ensuring user's local bin is on PATH ENV PATH="/home/user/.local/bin:$PATH" # Setting working directory inside container WORKDIR /app # Installing Python dependencies COPY --chown=user ./req.txt req.txt RUN pip install --no-cache-dir --upgrade -r req.txt # Copying the rest of your app code COPY --chown=user . /app # Starting the Flask app using gunicorn CMD ["gunicorn", "--bind", "0.0.0.0:7860", "rm:app","--timeout","120","--workers","1"]