File size: 1,236 Bytes
8d3e440 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 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"]
|