master
parent
67d03a9b9d
commit
2e4709bdd8
47
Dockerfile
47
Dockerfile
|
@ -15,16 +15,11 @@ RUN apt-get update && apt-get install -y \
|
|||
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
|
||||
# Clone whisper.cpp
|
||||
RUN git clone https://github.com/ggerganov/whisper.cpp.git /whisper_src
|
||||
WORKDIR /whisper_src
|
||||
RUN make
|
||||
|
||||
# Verify main executable was built
|
||||
# RUN ls -lh main && file main
|
||||
|
||||
FROM ubuntu:22.04 AS runtime
|
||||
|
||||
# Install runtime dependencies
|
||||
|
@ -32,32 +27,32 @@ RUN apt-get update && apt-get install -y \
|
|||
python3 \
|
||||
python3-pip \
|
||||
ffmpeg \
|
||||
libavcodec-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
libswresample-dev \
|
||||
libavcodec58 \
|
||||
libavformat58 \
|
||||
libavutil56 \
|
||||
libswresample3 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create directory structure first
|
||||
RUN mkdir -p /whisper.cpp
|
||||
# Create non-root user and directory structure
|
||||
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 --from=builder /whisper.cpp /whisper.cpp
|
||||
# Copy only necessary files from builder
|
||||
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 models/ggml-tiny.en.bin /whisper.cpp/models/ggml-tiny.en.bin
|
||||
|
||||
WORKDIR /whisper.cpp
|
||||
# Copy model and application files
|
||||
COPY --chown=whisperuser:whisperuser models/ggml-tiny.en.bin /app/whisper.cpp/models/
|
||||
COPY --chown=whisperuser:whisperuser app.py /app/
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip3 install flask flask-cors
|
||||
|
||||
# Copy API server script
|
||||
COPY app.py .
|
||||
|
||||
# Verify files exist
|
||||
#RUN ls -lh models/ggml-tiny.en.bin
|
||||
WORKDIR /app
|
||||
USER whisperuser
|
||||
|
||||
EXPOSE 4002
|
||||
|
||||
CMD ["python3", "app.py"]
|
||||
CMD ["python3", "app.py"]
|
Loading…
Reference in New Issue