stt-whisper-cpp-ap/Dockerfile

47 lines
1000 B
Docker

# Base image
FROM ubuntu:22.04
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
git \
cmake \
make \
g++ \
ffmpeg \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Clone whisper.cpp and compile
RUN git clone https://github.com/ggerganov/whisper.cpp.git && \
cd whisper.cpp && \
make
# Download the small.en model
RUN cd whisper.cpp/models && \
curl -L "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en.bin" --output ggml-small.en.bin
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy API code
COPY app.py .
# Create uploads directory
RUN mkdir -p uploads
# Environment variables (adjust paths if needed)
ENV WHISPER_CPP_PATH="/app/whisper.cpp/main"
ENV MODEL_PATH="/app/whisper.cpp/models/ggml-small.en.bin"
# Expose Flask port
EXPOSE 4002
# Run the API
CMD ["python3", "app.py"]