FROM python:3.10-slim WORKDIR /app # Install build tools for Rust-based components RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential curl git rustc cargo \ && rm -rf /var/lib/apt/lists/* # Install python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy all files from your repo root to /app COPY . . # --- THE CRITICAL FIX --- # Nanochat looks for these in a specific hidden path. # We create that path and copy your uploaded files there. RUN mkdir -p /root/.cache/nanochat/tokenizer/ && \ cp tokenizer.pkl /root/.cache/nanochat/tokenizer/tokenizer.pkl && \ cp token_bytes.pt /root/.cache/nanochat/tokenizer/token_bytes.pt # Ensure the Hugging Face 'user' (UID 1000) can also see them RUN mkdir -p /.cache/nanochat/tokenizer/ && \ cp tokenizer.pkl /.cache/nanochat/tokenizer/tokenizer.pkl && \ cp token_bytes.pt /.cache/nanochat/tokenizer/token_bytes.pt && \ chmod -R 777 /.cache EXPOSE 7860 ENV GRADIO_SERVER_NAME="0.0.0.0" CMD ["python", "app.py"]