FROM ubuntu:22.04 AS builder # Install build dependencies RUN apt-get update && apt-get install -y \ git \ cmake \ make \ g++ \ python3 \ python3-pip \ ffmpeg \ libavcodec-dev \ libavformat-dev \ libavutil-dev \ libswresample-dev \ && rm -rf /var/lib/apt/lists/* # Clone whisper.cpp (use specific known-working commit) RUN git clone https://github.com/ggerganov/whisper.cpp.git /whisper.cpp WORKDIR /whisper.cpp # Checkout a stable commit if needed # RUN git checkout 5a8b1b4 RUN make # Verify main executable was built # RUN ls -lh main && file main FROM ubuntu:22.04 AS runtime # Install runtime dependencies RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ ffmpeg \ libavcodec-dev \ libavformat-dev \ libavutil-dev \ libswresample-dev \ && rm -rf /var/lib/apt/lists/* # Create directory structure first RUN mkdir -p /whisper.cpp # Copy the entire whisper.cpp directory (includes main executable and required files) COPY --from=builder /whisper.cpp /whisper.cpp # Copy your local model COPY models/ggml-tiny.en.bin /whisper.cpp/models/ggml-tiny.en.bin WORKDIR /whisper.cpp # Install Python dependencies RUN pip3 install flask flask-cors # Copy API server script COPY app.py . # Verify files exist RUN ls -lh main models/ggml-tiny.en.bin EXPOSE 5000 CMD ["python3", "app.py"]