chatbot / Dockerfile
doublesizebed's picture
Updates
dc0e2d8
FROM python:3.9-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg git build-essential python3-dev && \
rm -rf /var/lib/apt/lists/*
# Install CPU-specific PyTorch (wheel from PyTorch index)
RUN pip install torch==2.1.1+cpu torchvision==0.16.1+cpu torchaudio==2.1.1+cpu \
-f https://download.pytorch.org/whl/torch_stable.html
# Set working directory
WORKDIR /app/chatbot
# Allow deprecated sklearn install if needed
ENV SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True
# Upgrade pip and install Cython first (for youtokentome)
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir Cython
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Set environment variables
ENV HF_HOME=/data/hf_cache
ENV TRANSFORMERS_CACHE=/data/transformers_cache
ENV NLTK_DATA=/data/nltk_data
ENV AUDIO_FOLDER=/data/audio
# Create writable directories
RUN mkdir -p /data/hf_cache /data/transformers_cache /data/nltk_data /data/audio /static/audio && \
chmod -R 777 /data /static && \
chmod -R 777 /root/.cache
# Copy application code
COPY . .
EXPOSE 7860
CMD ["python", "app.py"]