gpt4free
gpt4free copied to clipboard
Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
/usr/app/venv/lib/python3.11/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
按照dockerfile构造的镜像,运行起来后报这个错误,但是我看dockerfile第一阶段已经安装了ffmpeg了,为啥里面还是提示找不到ffmpeg?
作者的Dockerfile使用了多阶段构建,每个阶段都是独立的,第一阶段安装了ffmpeg,第二阶段并未安装,所以需要再次安装
FROM python:3.11 as builder
WORKDIR /usr/app
ENV PATH="/usr/app/venv/bin:$PATH"
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list &&\
sed -i 's/http:/https:/g' /etc/apt/sources.list&&\
apt-get update && apt-get install -y --no-install-recommends ffmpeg &&\
rm -rf /var/lib/apt/lists/*
RUN mkdir -p /usr/app
RUN python -m venv ./venv
COPY requirements.txt .
RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
RUN pip config set global.trusted-host mirrors.aliyun.com
RUN pip install -r requirements.txt
FROM python:3.11
WORKDIR /usr/app
ENV PATH="/usr/app/venv/bin:$PATH"
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list &&\
sed -i 's/http:/https:/g' /etc/apt/sources.list&&\
apt-get update && apt-get install -y --no-install-recommends \
ffmpeg\
inetutils-ping \
telnet
COPY --from=builder /usr/app/venv ./venv
COPY . .
RUN cp ./gui/streamlit_app.py .
CMD ["streamlit", "run", "streamlit_app.py"]
EXPOSE 8501
Notes: head.zip downloaded manually
FROM python:3.11
RUN sed -i 's/deb.debian.org/mirrors.aliyun.com/g' /etc/apt/sources.list &&
sed -i 's/http:/https:/g' /etc/apt/sources.list&&
apt-get update
&& apt-get install -y --no-install-recommends ffmpeg
&& apt-get -y clean
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /tmp COPY head.zip /tmp RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ RUN pip config set global.trusted-host mirrors.aliyun.com
RUN pip install --upgrade pip
&& pip install -r /tmp/requirements.txt
&& rm /tmp/requirements.txt
COPY . /root/gpt4free
WORKDIR /root/gpt4free
CMD ["streamlit", "run", "./gui/streamlit_app.py"]
EXPOSE 8501