我的容器打算用作一名芹菜工人,其任务依赖于ImageMagick和FFMPEG。这建立没有问题。此外,如果我运行(注释掉了)CMD celery
,那么芹菜就开始存在问题了。然后找不到ffmpeg。
CMD ffmpeg
命令对其进行测试,当前仅返回/bin/sh: 1: ffmpeg: not found
。我该如何解决?
FROM alpine:latest
RUN apk add --update ffmpeg
FROM python:3.7
WORKDIR /
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
RUN rm requirements.txt
RUN apt-get install imagemagick
COPY . /
WORKDIR /
# Run celery.py when the container launches. Commented out to test ffmpeg.
# CMD ["celery", "worker", "-A", "a.celery", "--loglevel=info"]
CMD ffmpeg
如果我改为执行以下操作,它将起作用:
FROM alpine:latest
RUN apk add --update ffmpeg
CMD ffmpeg
答案 0 :(得分:0)
问题在于未链接库。以下作品:
FROM python:3.7
# This below is sufficient by itself to yield ffmpeg. However, we want to use
# the jrottenberg version.
# COPY --from=mwader/static-ffmpeg:4.1.4-2 /ffmpeg /ffprobe /usr/local/bin/
# jrottenberg version
ENV LD_LIBRARY_PATH=/usr/local/lib
COPY --from=jrottenberg/ffmpeg /usr/local /usr/local/
WORKDIR /
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
RUN rm requirements.txt
RUN apt-get install imagemagick
COPY . /
WORKDIR /
CMD ffmpeg