Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748# Use Python 3.9 slim imageFROM python:3.9-slim# Set working directoryWORKDIR /app# Install system dependenciesRUN apt-get update && apt-get install -y \build-essential \curl \software-properties-common \git \&& rm -rf /var/lib/apt/lists/*# Copy requirements and install Python dependenciesCOPY requirements.txt ./RUN pip3 install --no-cache-dir -r requirements.txt# Set NLTK data directory to a location with proper permissionsENV NLTK_DATA=/usr/local/share/nltk_dataRUN mkdir -p $NLTK_DATA# Download NLTK data as root (with permissions) and handle SSL issuesRUN python -c "import ssl; ssl._create_default_https_context = ssl._create_unverified_context; import nltk; nltk.download('stopwords', download_dir='/usr/local/share/nltk_data'); nltk.download('wordnet', download_dir='/usr/local/share/nltk_data'); nltk.download('omw-1.4', download_dir='/usr/local/share/nltk_data')"# Copy the application codeCOPY . .# Create necessary directories with proper permissionsRUN mkdir -p models artifacts vectorizersRUN chmod -R 755 models artifacts vectorizers# Create a non-root user for securityRUN useradd -m -u 1000 userRUN chown -R user:user /appUSER user# Set environment variablesENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH \PYTHONPATH=/app \NLTK_DATA=/usr/local/share/nltk_data# Expose the port that Streamlit runs onEXPOSE 8501# Run the applicationCMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]123456FROM python:3.11-slimWORKDIR /appCOPY requirements.txt .RUN pip install --no-cache-dir -r requirements.txtCOPY . .CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
Dockerfile+4-46