This commit is contained in:
Kar
2025-06-15 00:39:51 +05:30
parent dc5c455f0e
commit 4eca03a945
3 changed files with 91 additions and 25 deletions

View File

@@ -1,19 +1,46 @@
FROM python:3.10-slim
# Base image
FROM ubuntu:22.04
# Install dependencies
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
python3-pip \
git \
cmake \
make \
g++ \
ffmpeg \
curl \
&& rm -rf /var/lib/apt/lists/*
&& 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 app and model
COPY app ./app
# 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
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "4002"]
# Run the API
CMD ["python3", "app.py"]