# 1. Use the stable PyTorch 2.0.1 base image FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ curl \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* # 2. Copy requirements COPY requirements.txt ./ # 3. CRITICAL: Force reinstall to ensure we get Transformers 4.32.0 and NumPy 1.24.4 # This overwrites any pre-installed versions in the base image RUN pip install --no-cache-dir --upgrade --force-reinstall -r requirements.txt # 4. Download spaCy model RUN python3 -m spacy download en_core_web_sm # 5. Copy your source code (Ensure your code is in src/streamlit_app.py) COPY src/ ./src/ # 6. Expose port and run EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]