whisper / Dockerfile
1een's picture
cp
db27b69
FROM ghcr.io/ggml-org/whisper.cpp:main
# 设置工作目录
WORKDIR /app
# 创建缓存目录并设置权限
RUN mkdir -p /app/.cache && chmod 777 /app/.cache
# 设置环境变量
ENV XDG_CACHE_HOME=/app/.cache
# 安装系统依赖
RUN apt-get update && apt-get install -y \
python3-pip \
git \
&& rm -rf /var/lib/apt/lists/*
# RUN cat /proc/cpuinfo
RUN nproc
# 复制依赖文件
COPY requirements.txt .
# 安装Python依赖
RUN pip install --no-cache-dir -r requirements.txt
# 创建模型目录
# RUN mkdir -p /app/models
# 下载Whisper模型
RUN curl -L https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin -o /app/models/ggml-tiny.bin && \
curl -L https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.bin -o /app/models/ggml-base.bin && \
curl -L https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin -o /app/models/ggml-small.bin && \
curl -L https://huggingface.co/ggml-org/whisper-vad/resolve/main/ggml-silero-v5.1.2.bin -o /app/models/ggml-silero-v5.1.2.bin
# 复制应用代码
COPY . .
# 暴露端口
EXPOSE 7860
# 添加执行权限
RUN chmod +x startup.sh
# free -h
RUN free -h && df -h
RUN cat /etc/os-release
# 使用启动脚本
CMD ["./startup.sh"]