# Use an official PyTorch image as the base | |
FROM pytorch/pytorch:latest | |
# Set working directory | |
WORKDIR /app | |
# Install necessary Python libraries | |
RUN pip install --no-cache-dir transformers datasets accelerate peft torch torchvision torchaudio sentencepiece | |
# Copy all local files into the container | |
COPY . . | |
# Set a writable cache directory inside the app folder | |
# Set writable cache directory inside the app folder | |
ENV HF_HOME=/app/hf_cache | |
ENV HF_DATASETS_CACHE=/app/hf_cache | |
ENV TRANSFORMERS_CACHE=/app/hf_cache | |
# Create the cache directory and set correct permissions | |
RUN mkdir -p /app/hf_cache/hub && chmod -R 777 /app/hf_cache | |
# Set default command (replace with your training script later) | |
CMD ["python", "train.py"] | |