Dockerfile 950 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. FROM python:3.11-slim
  2. # Install system dependencies
  3. RUN apt-get update && apt-get install -y \
  4. ffmpeg \
  5. git \
  6. build-essential \
  7. cmake \
  8. curl \
  9. && rm -rf /var/lib/apt/lists/*
  10. # Create working directory
  11. WORKDIR /app
  12. # Copy Python dependencies
  13. COPY requirements.txt .
  14. # Install Python dependencies
  15. RUN pip install --no-cache-dir -r requirements.txt
  16. # Copy server
  17. COPY server.py .
  18. # Clone whisper.cpp
  19. RUN git clone https://github.com/ggerganov/whisper.cpp.git
  20. # Build whisper.cpp
  21. RUN cmake -S whisper.cpp -B whisper.cpp/build \
  22. && cmake --build whisper.cpp/build --config Release
  23. # Download model
  24. RUN bash whisper.cpp/models/download-ggml-model.sh small
  25. # Environment variables for server.py
  26. ENV WHISPER_BIN=/app/whisper.cpp/build/bin/whisper-cli
  27. ENV MODEL_PATH=/app/whisper.cpp/models/ggml-small.bin
  28. # Expose API port
  29. EXPOSE 5005
  30. # Run with gunicorn
  31. CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:5005", "server:app"]