FROM python:3.9-slim # Install system dependencies RUN apt-get update && apt-get install -y \ git \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* # Create cache directory with correct permissions RUN mkdir -p /cache/models /cache/datasets && \ chmod -R 777 /cache # Full permissions for all users # Install Python packages RUN pip install --no-cache-dir \ torch==2.1.2+cpu -f https://download.pytorch.org/whl/torch_stable.html \ transformers==4.36.0 \ sentencepiece==0.2.0 \ accelerate==0.25.0 \ huggingface-hub==0.19.4 \ gradio==3.50.2 \ datasets==2.15.0 \ safetensors==0.4.1 # Configure cache ENV TRANSFORMERS_CACHE="/cache/models" ENV HF_DATASETS_CACHE="/cache/datasets" WORKDIR /app COPY . /app CMD ["python", "app.py"]