Dockerfile 882 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # build image
  2. FROM debian:bullseye-slim AS builder
  3. WORKDIR /build/
  4. RUN apt-get update && apt-get install --no-install-recommends -y \
  5. make gcc g++ wget \
  6. && apt-get clean \
  7. && rm -rf /var/lib/apt/lists/*
  8. # Install Whisper.cpp
  9. ADD whisper.cpp/ /build/
  10. RUN make
  11. # main image
  12. FROM python:3.12-slim-bullseye
  13. WORKDIR /app/
  14. # Install dependencies
  15. RUN apt-get update && apt-get install -y \
  16. ffmpeg libolm-dev gcc make wget\
  17. && apt-get clean \
  18. && rm -rf /var/lib/apt/lists/*
  19. ADD requirements.txt .
  20. RUN pip install -r requirements.txt && \
  21. apt-get remove -y gcc make && \
  22. apt-get autoremove -y
  23. COPY --from=builder /build/main /app/
  24. VOLUME /data/
  25. ADD ./*.py /app/
  26. ARG PRELOAD_MODEL
  27. ENV PRELOAD_MODEL ${PRELOAD_MODEL}
  28. RUN if [ -n "$PRELOAD_MODEL" ]; then wget -nv "https://ggml.ggerganov.com/ggml-model-whisper-$PRELOAD_MODEL.bin"; fi
  29. CMD ["python3", "-u", "main.py"]