FROM python:3.11-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ ffmpeg \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy requirements first for better caching COPY requirements.txt . # Install PyTorch CPU version first RUN pip install --no-cache-dir torch==2.0.1+cpu --index-url https://download.pytorch.org/whl/cpu # Install other Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Set environment variables ENV PYTHONUNBUFFERED=1 ENV STREAMLIT_SERVER_HEADLESS=true ENV STREAMLIT_SERVER_ENABLE_CORS=false ENV STREAMLIT_SERVER_PORT=8501 ENV HF_HOME=/tmp/huggingface ENV TRANSFORMERS_CACHE=/tmp/transformers ENV KERAS_BACKEND=tensorflow # Expose port EXPOSE 8501 # Run the app CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]