thera-guide-ai / Dockerfile
Said Lfagrouche
Initial commit with Git LFS enabled
8e66145
raw
history blame
1.57 kB
FROM python:3.13-slim
WORKDIR /app
# Install git and git-lfs for downloading large files (if needed)
RUN apt-get update && \
apt-get install -y git git-lfs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy requirements file
COPY requirements.txt .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Download NLTK data
RUN python -c "import nltk; nltk.download('punkt'); nltk.download('wordnet'); nltk.download('stopwords')"
# Create necessary directories
RUN mkdir -p data/users data/sessions data/conversations data/feedback
RUN mkdir -p mental_health_model_artifacts/chroma_db
# Copy application files
COPY api_mental_health.py .
COPY .env.example .env
COPY create_vector_db.py .
# Copy model artifacts if they exist, or they should be mounted/downloaded at runtime
# Note: For Hugging Face Spaces deployment, you'll need to use Git LFS or
# provide a way to download these models at container startup
COPY mental_health_model_artifacts/ mental_health_model_artifacts/
# Create a startup script to handle potential model downloading
RUN echo '#!/bin/bash\n\
# Check if models exist\n\
if [ ! -f "mental_health_model_artifacts/crisis_classifier.pkl" ]; then\n\
echo "Warning: Model artifacts not found. Please mount them or implement a download method."\n\
fi\n\
# Start the API server\n\
exec uvicorn api_mental_health:app --host 0.0.0.0 --port 7860\n\
' > /app/start.sh && chmod +x /app/start.sh
# Expose the port Hugging Face Spaces expects
EXPOSE 7860
# Use the startup script
CMD ["/app/start.sh"]