49 lines
1.1 KiB
Docker
49 lines
1.1 KiB
Docker
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 (shallow clone)
|
|
RUN git clone --depth 1 https://github.com/ggerganov/whisper.cpp.git
|
|
RUN ls
|
|
# Build whisper.cpp properly
|
|
RUN cd whisper.cpp && \
|
|
make
|
|
|
|
# Verify the binary was built
|
|
RUN ls -lh /app/whisper.cpp/main
|
|
|
|
# Download the small.en model
|
|
RUN mkdir -p /app/whisper.cpp/models && \
|
|
cd /app/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
|
|
|
|
# Set environment variables
|
|
ENV WHISPER_CPP_PATH="/app/whisper.cpp/main"
|
|
ENV MODEL_PATH="/app/whisper.cpp/models/ggml-small.en.bin"
|
|
|
|
EXPOSE 5000
|
|
CMD ["python3", "app.py"]
|