master
Kar 2025-06-15 23:23:08 +05:30
parent 67d03a9b9d
commit 2e4709bdd8
1 changed files with 21 additions and 26 deletions

View File

@ -15,16 +15,11 @@ RUN apt-get update && apt-get install -y \
libswresample-dev \ libswresample-dev \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Clone whisper.cpp (use specific known-working commit) # Clone whisper.cpp
RUN git clone https://github.com/ggerganov/whisper.cpp.git /whisper.cpp RUN git clone https://github.com/ggerganov/whisper.cpp.git /whisper_src
WORKDIR /whisper.cpp WORKDIR /whisper_src
# Checkout a stable commit if needed
# RUN git checkout 5a8b1b4
RUN make RUN make
# Verify main executable was built
# RUN ls -lh main && file main
FROM ubuntu:22.04 AS runtime FROM ubuntu:22.04 AS runtime
# Install runtime dependencies # Install runtime dependencies
@ -32,31 +27,31 @@ RUN apt-get update && apt-get install -y \
python3 \ python3 \
python3-pip \ python3-pip \
ffmpeg \ ffmpeg \
libavcodec-dev \ libavcodec58 \
libavformat-dev \ libavformat58 \
libavutil-dev \ libavutil56 \
libswresample-dev \ libswresample3 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Create directory structure first # Create non-root user and directory structure
RUN mkdir -p /whisper.cpp RUN useradd -m whisperuser && \
mkdir -p /app/whisper.cpp && \
chown whisperuser:whisperuser /app
# Copy the entire whisper.cpp directory (includes main executable and required files) # Copy only necessary files from builder
COPY --from=builder /whisper.cpp /whisper.cpp COPY --from=builder --chown=whisperuser:whisperuser /whisper_src/main /app/whisper.cpp/main
COPY --from=builder --chown=whisperuser:whisperuser /whisper_src/libwhisper.a /app/whisper.cpp/
COPY --from=builder --chown=whisperuser:whisperuser /whisper_src/include /app/whisper.cpp/include
# Copy your local model # Copy model and application files
COPY models/ggml-tiny.en.bin /whisper.cpp/models/ggml-tiny.en.bin COPY --chown=whisperuser:whisperuser models/ggml-tiny.en.bin /app/whisper.cpp/models/
COPY --chown=whisperuser:whisperuser app.py /app/
WORKDIR /whisper.cpp
# Install Python dependencies # Install Python dependencies
RUN pip3 install flask flask-cors RUN pip3 install flask flask-cors
# Copy API server script WORKDIR /app
COPY app.py . USER whisperuser
# Verify files exist
#RUN ls -lh models/ggml-tiny.en.bin
EXPOSE 4002 EXPOSE 4002