# Use CUDA-enabled PyTorch base image FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ wget \ && rm -rf /var/lib/apt/lists/* # Copy requirements file COPY requirements.txt . # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy project files COPY . . # Create directories for data and models RUN mkdir -p weights # Set environment variables ENV PYTHONPATH=/app ENV ONNX_MODEL_PATH="weights/toxic_classifier.onnx" ENV PYTORCH_MODEL_DIR="weights/toxic_classifier_xlm-roberta-large" ENV PORT=7860 # Set the entry point to run the Streamlit app CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]