41 строка
1.5 KiB
Docker
41 строка
1.5 KiB
Docker
### Whisper.cpp Container - CPU only
|
|
### High-performance Speech-to-Text using OpenAI's Whisper model
|
|
### Based on whisper.cpp: https://github.com/ggml-org/whisper.cpp
|
|
###
|
|
### BUILD: ./build-container-cpu.sh (compiles locally, CPU-only)
|
|
### THEN: podman build -t whisper:cpu-amd64 -f whisper-cpu.Containerfile .
|
|
### With custom model: podman build --build-arg MODELS="small" -t whisper:cpu-amd64 -f whisper-cpu.Containerfile .
|
|
FROM ubuntu:26.04
|
|
ARG MODELS=small
|
|
USER root
|
|
EXPOSE 8080
|
|
RUN apt-get update \
|
|
&& apt-get install -y curl ffmpeg nano \
|
|
&& apt-get autoremove -y \
|
|
&& apt-get clean -y \
|
|
&& rm -rf /tmp/* /var/tmp/* \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
|
|
&& find /var/cache -type f -delete
|
|
WORKDIR /app
|
|
# Copy pre-compiled CPU-only binaries
|
|
COPY bin-cpu/ /app/
|
|
RUN chmod +x /app/whisper-*
|
|
# Copy models downloader and entrypoint
|
|
COPY models/download-ggml-model.sh /app/
|
|
COPY entrypoint.sh /app/
|
|
RUN chmod +x /app/download-ggml-model.sh /app/entrypoint.sh
|
|
# Create models directory (will be mounted as volume at runtime)
|
|
RUN mkdir -p /app/models
|
|
# Set environment variables
|
|
ENV PATH=/app:$PATH
|
|
ENV LD_LIBRARY_PATH=/app:/usr/local/lib:/usr/lib:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH
|
|
ENV HF_HUB_ENABLE_HF_TRANSFER=1
|
|
# Whisper model configuration
|
|
# MODELS arg is passed but not used during build (downloaded at runtime)
|
|
ENV WHISPER_MODEL_NAME=${MODELS}
|
|
ENV WHISPER_MODEL_FILE=ggml-${MODELS}.bin
|
|
WORKDIR /app
|
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
CMD []
|