Docker Container start cache issue

Hey!
I am using docker to deploy a container with my streamlit app. Upon first start I always got almost random import and cache errors like the cold start goes reading part of the main py file. Here an a screenshot


Right after I refresh I have no issues for the whole lifespan of the container.

and yes, the monkey patch is there and the set_page command is on top, so that after a first refresh all is good.

Any idea on how to prevent this?

Here my docker file

# Use official Python image as a base
FROM python:3.11

# Set the working directory in the container
WORKDIR /app

# Install system dependencies for Tesseract
RUN apt-get update && apt-get install -y \
    build-essential \
    tesseract-ocr \
    libtesseract-dev \
    poppler-utils \
    && rm -rf /var/lib/apt/lists/*

# Copy the current directory contents into the container
COPY . /app

RUN pip install --upgrade pip setuptools wheel

# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt

RUN sed -i 's|<title>Streamlit</title>|<title>Quanta AI</title>|' $(python -c "import streamlit as st; print(st.__path__[0])")/static/index.html

# Expose the Streamlit default port
EXPOSE 8501

RUN find . -type f -name '*.pyc' -delete

# Run Streamlit when the container starts
#CMD ["streamlit", "run", "quanta.py", "--server.port=8501", "--server.address=0.0.0.0"]
CMD ["sh", "-c", "streamlit cache clear && streamlit run quanta.py --server.port=8501 --server.address=0.0.0.0"]