| # Use official Python base image | |
| FROM python:3.9 | |
| # Add a non-root user (required by Hugging Face Spaces) | |
| RUN useradd -m -u 1000 user | |
| WORKDIR /app | |
| # Copy requirements and install dependencies | |
| COPY requirements.txt ./requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy your notebooks and other files | |
| COPY . /app | |
| # Switch to non-root user | |
| USER user | |
| # Set environment variables including fixed JUPYTER_TOKEN | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| JUPYTER_TOKEN=curseofwitcher | |
| # Run JupyterLab on port 7860 with no browser and allow root | |
| CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=7860", "--no-browser", "--allow-root"] | |