How to install ffmpeg 6 in a dockerized Debian 11?

I have a Debian docker image that is running my web app, this is the head of my Dockerfile:

FROM ruby:3.0.2

# Install dependencies
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs

# Install ffmpeg for video processing
RUN apt-get install -y ffmpeg

The Debian that is installed is version 11.1:

cat /etc/debian_version

The ffmpeg that is installed is 4.3.5:

ffmpeg -version
ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers

I make intensive use of ffmpeg on this docker image, and I would like to have the last version that right now it is 6.1.1.

How can I configure my Dockerfile so that the last version of ffmpeg is installed when the image is built?

Read more here: Source link