FROM python:3.9 # Create a user and set it up for running the application RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory for your app WORKDIR /app # Copy the requirements file and install dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the rest of the application code COPY --chown=user . /app # Use gunicorn to serve the application, specifying the number of workers and binding it to the correct port CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "app:app","--timeout","120"]