The context is the following: I need to run ffmpeg in a AWS Lambda service that is deployed and build using Docker. Since the docker image we use is not debian and does not includes ffmpeg, I created a binary file with the command and added it to the project files. Then, inside the Dockerfile, I create a link to these binary so the command is included in /bin.
This is the Dockerfile:
FROM lambci/lambda:build-nodejs6.10
# Create app directory
WORKDIR /app
# Install app dependencies
COPY package.json .
COPY yarn.lock .
#add ffmpeg files
COPY binaries .binaries
#make link to ffmpeg
RUN ln -s /app/.binaries/bin/ffmpeg /bin/ffmpeg
RUN npm install --global yarn
RUN yarn install
RUN yarn global add serverless@~1.24.1
# Bundle app source
COPY . .
EXPOSE 8080
CMD [ "yarn", "run", "deploy" ]
Although this seems to be working in local environment (the command responds when called from console inside docker's image), it does not work when deployed to stage:
/bin/sh: ffmpeg: command not found
I recommend replacing CMD [ "yarn", "run", "deploy" ]
with
ENTRYPOINT ["sh", "/app/.binaries/yarn"]
CMD ["run", "deploy"]
I think you have 2 problems:
yarn
is executable? I don't know it is not, but explicitly calling sh
means that it does not matter. yarn
is in the path. Explicitly using the absolute path of yarn
means it should not matter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.