# Use a Hugging Face image with PyTorch and Transformers FROM huggingface/transformers-pytorch-gpu:latest # Set the working directory inside the container WORKDIR /app # Copy the requirements file first (to leverage Docker's caching mechanism) COPY requirements.txt . # Ensure the results directory has the right permissions RUN mkdir -p /app/results && chmod -R 777 /app/results RUN mkdir -p /app/saved_model && chmod -R 777 /app/saved_model # Set the environment variable for Hugging Face cache RUN mkdir -p /tmp/transformers_cache && chmod -R 777 /tmp/transformers_cache ENV TRANSFORMERS_CACHE=/tmp/transformers_cache ENV HF_HOME=/tmp/transformers_cache # Install and update python3 RUN apt update RUN apt install -y git libsndfile1-dev tesseract-ocr espeak-ng python3 python3-pip ffmpeg RUN python3 -m pip install --no-cache-dir --upgrade pip # Install dependencies RUN python3 -m pip install --no-cache-dir -r requirements.txt # Copy all remaining files into the container COPY . . # Run the training script when the container starts CMD ["python3", "train.py"]