diff --git a/Dockerfile b/Dockerfile index b2dbb31..0cda77c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ # Derivatives include -dev variation which adds git, build-essentials, # source repos, etc. # -FROM amr-registry.caas.intel.com/vtt-osgc/os/osgc-ubuntu:eoan +FROM amr-registry.caas.intel.com/vtt-osgc/os/osgc-ubuntu:disco # # Template begins here (from templates/templates/05-intel-proxy.in) @@ -94,9 +94,9 @@ RUN apt-add-repository "deb [arch=amd64] http://osgc.jf.intel.com/packages/agama # Update and install the Mesa, OpenCL, and Media from Agama RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -q -y install \ - libgl1-mesa-glx=19.1.0.agama-109 libgl1-mesa-dri=19.1.0.agama-109 \ - intel-opencl=19.32.109 \ - intel-media=2.10.109 libva2=2.4.0.agama-109 \ + libgl1-mesa-glx=19.1.0.agama-169 libgl1-mesa-dri=19.1.0.agama-169 \ + intel-opencl=19.38.169 \ + intel-media=2.10.169 libva2=2.6.0.agama-169 \ ocl-icd-libopencl1 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -105,25 +105,59 @@ RUN apt-get -q update \ # # Solution begins here (from Dockerfile.solution) # -# Fetch build tools and source for clinfo, then build it +# +# Docker.solution based on the Intel-Media-SDK instructions available here: +# +# https://github.com/Intel-Media-SDK/MediaSDK/wiki/Build-and-use-ffmpeg-with-MediaSDK # # This should really be part of a multi-stage build so the final # image isn't polluted with build artifacts # +# NOTE: This image will only work with Ubuntu 19.04 (disco) and newer + + +# Install git and build tools, clone ffmpeg, and get ready to build it RUN apt-get update \ - && apt-get remove -y clinfo \ - && DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -q -y install \ - git build-essential opencl-c-headers \ + && DEBIAN_FRONTEND=noninteractive apt-get -q -y install \ + git build-essential + +# Clone ffmpeg +# NOTE: This explicitly clones the FFMPEG_TAG_VERSION (see SOLUTIONS) +RUN git clone --depth 1 --branch n4.2.1 https://github.com/ffmpeg/ffmpeg /home/agama/ffmpeg + +# Install all required common packages: +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get -q -y install \ + libva-dev=2.6.0.agama-169 \ + libmfx-dev=19.2.pre3.agama-169 \ + libmfx1=19.2.pre3.agama-169 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -WORKDIR /home/agama +RUN apt-cache policy libmfx1 \ + && apt-cache policy libmfx-dev \ + && apt-cache search libmfx -RUN git clone https://gitlab.devtools.intel.com/jketreno/clinfo.git \ - && cd clinfo \ - && make +ENV LIBVA_DRIVER_NAME=iHD -RUN DEBIAN_FRONTEND=noninteractive apt-get remove -q -y git build-essential opencl-c-headers +# Build FFmpeg +WORKDIR /home/agama/ffmpeg -CMD [ "/home/agama/clinfo/clinfo" ] +RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \ + && make \ + && make install +# +# Standard ending begins here (from templates/ending.in) +# +# NOTE: This should be added as the last template entry +# as it will always modify a layer (since the Dockerfile +# changes,) causing all subsequent layers to be +# regenerated. + +# Ensure that each Docker container self-documents the +# versions included in it + +ENV AGAMA_VERSION=169 + +COPY MANIFEST SOLUTION Dockerfile /assets/ diff --git a/Dockerfile.solution b/Dockerfile.solution index b42938b..b2eb002 100644 --- a/Dockerfile.solution +++ b/Dockerfile.solution @@ -1,22 +1,41 @@ -# Fetch build tools and source for clinfo, then build it +# +# Docker.solution based on the Intel-Media-SDK instructions available here: +# +# https://github.com/Intel-Media-SDK/MediaSDK/wiki/Build-and-use-ffmpeg-with-MediaSDK # # This should really be part of a multi-stage build so the final # image isn't polluted with build artifacts # +# NOTE: This image will only work with Ubuntu 19.04 (disco) and newer + + +# Install git and build tools, clone ffmpeg, and get ready to build it RUN apt-get update \ - && apt-get remove -y clinfo \ - && DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -q -y install \ - git build-essential opencl-c-headers \ + && DEBIAN_FRONTEND=noninteractive apt-get -q -y install \ + git build-essential + +# Clone ffmpeg +# NOTE: This explicitly clones the FFMPEG_TAG_VERSION (see SOLUTIONS) +RUN git clone --depth 1 --branch $FFMPEG_TAG_VERSION https://github.com/ffmpeg/ffmpeg /home/agama/ffmpeg + +# Install all required common packages: +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get -q -y install \ + libva-dev=$LIBVA_DEV_VERSION \ + libmfx-dev=$LIBMFX_DEV_VERSION \ + libmfx1=$LIBMFX1_VERSION \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* -WORKDIR /home/agama +RUN apt-cache policy libmfx1 \ + && apt-cache policy libmfx-dev \ + && apt-cache search libmfx -RUN git clone https://gitlab.devtools.intel.com/jketreno/clinfo.git \ - && cd clinfo \ - && make +ENV LIBVA_DRIVER_NAME=iHD -RUN DEBIAN_FRONTEND=noninteractive apt-get remove -q -y git build-essential opencl-c-headers - -CMD [ "/home/agama/clinfo/clinfo" ] +# Build FFmpeg +WORKDIR /home/agama/ffmpeg +RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \ + && make \ + && make install diff --git a/README.md b/README.md index cab7164..6f6e759 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,13 @@ Solution specific definitions: CONTAINER_IMAGE is used as the container tag name OS_DISTRO is used as the base OS distribution. Possible values: ubuntu - OS_VERSION is used as the OS version. Possible values: disco, eoan + OS_RELEASE is used as the OS version. Possible values: disco, eoan ## MANIFEST -The version of MANIFEST was hard coded by reading the set of Agama packages -on my local disk, sorting, and name-mangling them to be VERSION declarations. +The version of MANIFEST is created by the set of Agama packages from the Agama +repository and name-mangling them to be a VERSION declaration: For example: @@ -62,6 +62,25 @@ is changed to: LIBGL1_MESA_GLX_VERSION=19.0.1-agama-109 +The script you can use to recreate the OS_RELEASE defined in SOLUTION is: + +NOTE: This only works on the Ubuntu releases. + +```bash +AGAMA_VERSION=169 +. SOLUTION +echo "AGAMA_VERSION=${AGAMA_VERSION}" > MANIFEST +wget -q -O - \ + https://osgc.jf.intel.com/packages/agama/ubuntu/dists/${OS_RELEASE}/main/binary-amd64/Packages.bz2 | + bunzip2 | + sed -nE 's/^(Package|Version): (.*)/\2/p' | + paste -s -d' \n' | + while read package version rest; do + package=$(echo $package | sed -E -e s#-#_#g -e 's#(.*)#\U\1#g')_VERSION + echo $package=$version + done | grep ${AGAMA_VERSION}\$ >> MANIFEST +``` + This allows the Dockerfile templates to then version pin Agama packages: ```Dockerfile @@ -72,23 +91,6 @@ The `scripts/build-dockerfile` loads MANIFEST, which defines LIBGL1_MESA_GLX_VERSION. That is then subsituted for the version in the above Dockerfile snippet when being placed into the main Dockerfile. -The generic script I ran to generate these names is below, although -it doesn't quite work and a few entries were modified by hand. This should -be replaced by a tool that is actually querying the .deb packages and -building the manifest. - -```bash -echo "AGAMA_VERSION=109" -find /var/www/packages/ -path '*public*' -name '*deb' -printf '%f\n' | - sort | - uniq | - sed -E \ - -e s,_,=,g \ - -e 's,=all\.deb|\.x86_64\.deb|=amd64\.deb,_VERSION,g' \ - -e s,-\([^0-9]\),_\\1,g \ - -e 's,^([^=]*),\U\1,' -``` - # Tagging If the build succeeds, we want to be able to tag the git project diff --git a/scripts/build-dockerfile b/scripts/build-dockerfile index 3d566d8..3cabae2 100755 --- a/scripts/build-dockerfile +++ b/scripts/build-dockerfile @@ -25,7 +25,7 @@ cat << EOM > Dockerfile # EOM -for snippet in templates/*.in; do +for snippet in templates/??-*.in; do cat << EOM >> Dockerfile # @@ -44,6 +44,15 @@ EOM envsubst < Dockerfile.solution >> Dockerfile +cat << EOM >> Dockerfile + +# +# Standard ending begins here (from templates/ending.in) +# +EOM + +envsubst < templates/ending.in >> Dockerfile + docker build . -t $CONTAINER:agama-${AGAMA_VERSION} cat << EOM diff --git a/templates/ending.in b/templates/ending.in new file mode 100644 index 0000000..79447e3 --- /dev/null +++ b/templates/ending.in @@ -0,0 +1,11 @@ +# NOTE: This should be added as the last template entry +# as it will always modify a layer (since the Dockerfile +# changes,) causing all subsequent layers to be +# regenerated. + +# Ensure that each Docker container self-documents the +# versions included in it + +ENV AGAMA_VERSION=${AGAMA_VERSION} + +COPY MANIFEST SOLUTION Dockerfile /assets/