FROM python:3.10-slim # Install system dependencies including curl RUN apt-get update && apt-get install -y curl git # Install Node.js 20.x RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - RUN apt-get install -y nodejs # Set up user for Hugging Face Spaces (UID 1000 is required by HF Spaces) RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app # Copy the entire repository into the container and set ownership COPY --chown=user . $HOME/app # Install Python dependencies RUN pip install --no-cache-dir -r backend/requirements.txt # Pre-download the Hugging Face MPNet tokenizer/model so it doesn't download on boot RUN python -c "from transformers import AutoTokenizer, AutoModel; AutoTokenizer.from_pretrained('sentence-transformers/all-mpnet-base-v2'); AutoModel.from_pretrained('sentence-transformers/all-mpnet-base-v2')" # Install Node.js dependencies and build Next.js WORKDIR $HOME/app/mindcheck-web RUN npm install RUN npm run build # Return to app root WORKDIR $HOME/app # Make start script executable RUN chmod +x start.sh # Hugging Face Spaces expects the app to run on port 7860 EXPOSE 7860 # Run the supervisor script CMD ["./start.sh"]