# FROM python:3.10-slim # # Set working directory # WORKDIR /app # # Copy everything into the container # COPY . /app # # Create a writable config directory for Matplotlib # RUN mkdir -p /app/.config/matplotlib # # Set environment variables for Hugging Face + Matplotlib # ENV MPLCONFIGDIR=/app/.config/matplotlib \ # PYTHONUNBUFFERED=1 \ # PIP_NO_CACHE_DIR=1 # # Install dependencies # RUN pip install --upgrade pip && \ # pip install -r requirements.txt # # Run setup script (e.g., download models) # RUN chmod +x setup.sh && ./setup.sh # # Expose port for Streamlit # EXPOSE 7860 # # Command to run Streamlit app # CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"] # Start from NVIDIA’s CUDA image with cuDNN support FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 # Set working directory WORKDIR /app # Install Python, pip, git, and other essentials RUN apt-get update && \ apt-get install -y python3.10 python3.10-venv python3-pip git curl && \ rm -rf /var/lib/apt/lists/* # Copy everything into the container COPY . /app # Create a writable config directory for Matplotlib RUN mkdir -p /app/.config/matplotlib # Set environment variables ENV MPLCONFIGDIR=/app/.config/matplotlib \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 # Upgrade pip and install dependencies RUN python3.10 -m pip install --upgrade pip && \ pip install -r requirements.txt # Run setup script (e.g., download models) RUN chmod +x setup.sh && ./setup.sh # Expose Streamlit port EXPOSE 7860 # Command to run Streamlit app CMD ["streamlit", "run", "test_app.py", "--server.port=7860", "--server.address=0.0.0.0"]