FROM python:3.10-slim # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 \ PORT=7860 # Set working directory to the user's home directory WORKDIR $HOME/app # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app # Install dependencies and Models RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt && \ python -m spacy download en_core_web_sm && \ python -m spacy download fr_core_news_sm && \ python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')" # Expose the API port (Hugging Face Spaces uses 7860 by default) EXPOSE 7860 # Set environment variables ENV SENTINEL_CONFIG=$HOME/app/sentinel.yaml # Run the Web Interface (Hugging Face expects an app on port 7860) CMD ["python", "ai_sentinel/web_interface.py"]