voicebot2 / Dockerfile
Gayatri kancharla
Update Dockerfile
7cd212b verified
# Use official Python 3.10 slim image as base
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Copy application files
COPY app.py .
COPY requirements.txt .
COPY README.md .
# Install system dependencies for librosa, soundfile, and numerical processing
RUN apt-get update && apt-get install -y \
libsndfile1 \
ffmpeg \
libatlas-base-dev \
gfortran \
build-essential \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Upgrade pip and install Python dependencies with verbose output and retry mechanism
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --retries 5 --timeout 100 -v -r requirements.txt || { echo "Dependency installation failed"; exit 1; }
# Verify key dependencies
RUN python -c "import gradio; print('Gradio version:', gradio.__version__)" || { echo "Gradio not installed"; exit 1; } && \
python -c "import librosa; print('Librosa version:', librosa.__version__)" || { echo "Librosa not installed"; exit 1; } && \
python -c "import numpy; print('NumPy version:', numpy.__version__)" || { echo "NumPy not installed"; exit 1; } && \
python -c "import torch; print('PyTorch version:', torch.__version__)" || { echo "PyTorch not installed"; exit 1; } && \
python -c "import transformers; print('Transformers version:', transformers.__version__)" || { echo "Transformers not installed"; exit 1; } && \
python -c "import soundfile; print('Soundfile version:', soundfile.__version__)" || { echo "Soundfile not installed"; exit 1; }
# Create directory for output files
RUN mkdir -p outputs
# Expose port 7860 for Gradio
EXPOSE 7860
# Command to run the Gradio application
CMD ["python", "app.py"]