58 linhas
1.8 KiB
Docker
58 linhas
1.8 KiB
Docker
### Whisper.cpp Container with Vulkan GPU support
|
|
### High-performance Speech-to-Text using OpenAI's Whisper model
|
|
### Based on whisper.cpp: https://github.com/ggml-org/whisper.cpp
|
|
###
|
|
### BUILD: ./build-container.sh (compiles locally with Vulkan)
|
|
### THEN: podman build -t whisper:vulkan-amd64 -f whisper-vulkan.Containerfile .
|
|
### With custom model: podman build --build-arg MODELS="small" -t whisper:vulkan-amd64 -f whisper-vulkan.Containerfile .
|
|
|
|
FROM debian:13-slim
|
|
#FROM ubuntu:26.04-slim
|
|
|
|
ARG MODELS=small
|
|
|
|
USER root
|
|
EXPOSE 8080
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y curl ffmpeg nano \
|
|
&& apt-get install -y libvulkan1 vulkan-tools mesa-vulkan-drivers libdrm-amdgpu1 \
|
|
&& 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 binaries with Vulkan support
|
|
COPY bin-vulkan/ /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
|
|
|
|
# Vulkan environment
|
|
ENV VK_DRIVER_FILES=/usr/share/vulkan/icd.d/radeon_icd.json
|
|
|
|
# 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 []
|