commit 159612c8ae9008045ad2aeae5b512d171def1b2f Author: James Ketrenos Date: Mon Sep 16 16:59:25 2019 -0700 Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7e33945 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,117 @@ + +# +# Template begins here (from templates/templates/00-FROM.in) +# +# Creates a base OSGC Intel enabled Ubuntu image +# +# Derivatives include -dev variation which adds git, build-essentials, +# source repos, etc. +# +FROM amr-registry.caas.intel.com/vtt-osgc/os/osgc-ubuntu:eoan + +# +# Template begins here (from templates/templates/05-intel-proxy.in) +# +# Pre-install proxy configuration values +# +# This uses the linux-ftp.ostc.intel.com as a mirror. +RUN echo "Acquire::http::proxy \"http://proxy-chain.intel.com:911/\";\n" \ + "Acquire::https::proxy \"https://proxy-chain.intel.com:911/\";\n" \ + "Acquire::ftp::proxy \"ftp://proxy-chain.intel.com:911/\";\n" \ + "Acquire::socks::proxy \"socks://proxy-chain.intel.com:1080/\";\n" \ + "Acquire::http::Proxy::linux-ftp.ostc.intel.com DIRECT;\n" \ + "Acquire::http::Proxy::osgc.jf.intel.com DIRECT;\n" > /etc/apt/apt.conf + +# +# Template begins here (from templates/templates/10-default-packages.in) +# +# Update the repo lists and then install things using the internal +# sources. Packages used by many developers are pulled into this image +# but we do want it to be relatively small. +# +# NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from +# trying to prompt for configuration details during install. +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install \ + -y --no-install-recommends -q \ + net-tools \ + iputils-ping \ + sudo \ + wget \ + locales \ + software-properties-common + +# Set up locales +RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 +ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 + +# +# Template begins here (from templates/templates/20-create-agama-user.in) +# +# Create user 'agama' and add them to 'sudo' for sudo access and set +# the passwd to 'agama' +# +# NOTE: Requires 'sudo' package to already be installed +RUN groupadd -r agama \ +&& useradd --no-log-init \ + -s /bin/bash \ + -r -m \ + -g agama \ + -G sudo \ + -p $(echo "agama" | openssl passwd -stdin) agama + +# Set 'sudo' to NOPASSWD for all container users +RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers + +# +# Template begins here (from templates/templates/25-install-agama.in) +# +# Update and install gpg-agent as it isn't in the base Ubuntu image and is needed for apt-key +RUN apt-get -q update \ + && DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -q -y install \ + gpg-agent + +# Fetch and install the signing key for OSGC's Agama repository +RUN wget --no-proxy --quiet -O /tmp/aptly.key http://osgc.jf.intel.com/packages/agama/ubuntu/aptly_repo_signing.key \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add /tmp/aptly.key \ + && rm /tmp/aptly.key + +# Add internal Agama repository +RUN apt-add-repository "deb [arch=amd64] http://osgc.jf.intel.com/packages/agama/ubuntu disco main" + +# 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 \ + ocl-icd-libopencl1 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + + +# +# Solution begins here (from Dockerfile.solution) +# +# Fetch build tools and source for clinfo, then build it +# +# This should really be part of a multi-stage build so the final +# image isn't polluted with build artifacts +# +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 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /home/agama + +RUN git clone https://gitlab.devtools.intel.com/jketreno/clinfo.git \ + && cd clinfo \ + && make + +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -q -y git build-essential opencl-c-headers + +CMD [ "/home/agama/clinfo/clinfo" ] + diff --git a/Dockerfile.solution b/Dockerfile.solution new file mode 100644 index 0000000..b42938b --- /dev/null +++ b/Dockerfile.solution @@ -0,0 +1,22 @@ +# Fetch build tools and source for clinfo, then build it +# +# This should really be part of a multi-stage build so the final +# image isn't polluted with build artifacts +# +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 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /home/agama + +RUN git clone https://gitlab.devtools.intel.com/jketreno/clinfo.git \ + && cd clinfo \ + && make + +RUN DEBIAN_FRONTEND=noninteractive apt-get remove -q -y git build-essential opencl-c-headers + +CMD [ "/home/agama/clinfo/clinfo" ] + diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..22a366b --- /dev/null +++ b/MANIFEST @@ -0,0 +1,46 @@ +AGAMA_VERSION=109 +INTEL_GMMLIB_VERSION=19.2.0.109 +INTEL_GMMLIB_DEVEL_VERSION=19.2.0.109 +INTEL_IGC_CORE_VERSION=1.0.10-109 +INTEL_IGC_MEDIA_VERSION=1.0.10-109 +INTEL_IGC_OPENCL_VERSION=1.0.10-109 +INTEL_IGC_OPENCL_DEVEL_VERSION=1.0.10-109 +INTEL_MEDIA_VERSION=2.10.109 +INTEL_OPENCL_VERSION=19.32.109 +INTEL_OPENCL_OCLOC_VERSION=19.32.109 +LIBD3DADAPTER9_MESA_VERSION=19.1.0.agama-109 +LIBD3DADAPTER9_MESA_DEV_VERSION=19.1.0.agama-109 +LIBEGL1_MESA_VERSION=19.1.0.agama-109 +LIBEGL1_MESA_DEV_VERSION=19.1.0.agama-109 +LIBEGL_MESA0_VERSION=19.1.0.agama-109 +LIBGBM1_VERSION=19.1.0.agama-109 +LIBGBM_DEV_VERSION=19.1.0.agama-109 +LIBGL1_MESA_DEV_VERSION=19.1.0.agama-109 +LIBGL1_MESA_DRI_VERSION=19.1.0.agama-109 +LIBGL1_MESA_GLX_VERSION=19.1.0.agama-109 +LIBGLAPI_MESA_VERSION=19.1.0.agama-109 +LIBGLES2_MESA_VERSION=19.1.0.agama-109 +LIBGLES2_MESA_DEV_VERSION=19.1.0.agama-109 +LIBGLX_MESA0_VERSION=19.1.0.agama-109 +LIBMFX1_VERSION=19.2.PRE3.agama-109 +LIBMFX_DEV_VERSION=19.2.PRE3.agama-109 +LIBMFX_TOOLS_VERSION=19.2.PRE3.agama-109 +LIBOPENCL_CLANG8_VERSION=8.0.0.agama-109 +LIBOPENCL_CLANG_DEV_VERSION=8.0.0.agama-109 +LIBOSMESA6_VERSION=19.1.0.agama-109 +LIBOSMESA6_DEV_VERSION=19.1.0.agama-109 +LIBVA2_VERSION=2.4.0.agama-109 +LIBVA_DEV_VERSION=2.4.0.agama-109 +LIBVA_DRM2_VERSION=2.4.0.agama-109 +LIBVA_GLX2_VERSION=2.4.0.agama-109 +LIBVA_WAYLAND2_VERSION=2.4.0.agama-109 +LIBVA_X11_2_VERSION=2.4.0.agama-109 +LIBWAYLAND_EGL1_MESA_VERSION=19.1.0.agama-109 +LIBXATRACKER2_VERSION=19.1.0.agama-109 +LIBXATRACKER_DEV_VERSION=19.1.0.agama-109 +MESA_COMMON_DEV_VERSION=19.1.0.agama-109 +MESA_OPENCL_ICD_VERSION=19.1.0.agama-109 +MESA_VA_DRIVERS_VERSION=19.1.0.agama-109 +MESA_VDPAU_DRIVERS_VERSION=19.1.0.agama-109 +MESA_VULKAN_DRIVERS_VERSION=19.1.0.agama-109 +VA_DRIVER_ALL_VERSION=2.4.0.agama-109 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2c3c274 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# Intel Media FFMPEG Transcode Container + +This project hosts a container demonstrating the use of ffmpeg +using GPU offload for transcode operations. + +The Dockerfile itself is constructed from re-usable snippets, +located in the templates/ directory, and can be regenerated +by running: + +```bash +scripts/build-dockerfile +``` + +The above script uses environment substitution to stamp version +information within the created Dockerfile. The files used are **SOLUTION**, +and **MANIFEST**. + +# SOLUTION + +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 + + +# 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. + +For example: + + libgl1-mesa-glx_19.0.1-agama-109_amd64.deb + +is changed to: + + LIBGL1_MESA_GLX_VERSION=19.0.1-agama-109 + +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,' +``` diff --git a/SOLUTION b/SOLUTION new file mode 100644 index 0000000..b4a08b3 --- /dev/null +++ b/SOLUTION @@ -0,0 +1,3 @@ +CONTAINER=intel-media-ffmpeg +OS_DISTRO=ubuntu +OS_RELEASE=eoan diff --git a/scripts/build-dockerfile b/scripts/build-dockerfile new file mode 100755 index 0000000..1da2107 --- /dev/null +++ b/scripts/build-dockerfile @@ -0,0 +1,32 @@ +#!/bin/bash + +# Bring in the variables from SOLUTION file +# +export $(grep -v '^#' SOLUTION | xargs -d '\n') +export $(grep -v '^#' MANIFEST | xargs -d '\n') + +# Remove the Dockerfile if it exists; should check +# if it is clean first, and abort if not. +# +[ -e Dockerfile ] && rm Dockerfile + +for snippet in templates/*.in; do + cat << EOM >> Dockerfile + +# +# Template $snippt begins here (from templates/${snippet}) +# +EOM + envsubst < $snippet >> Dockerfile +done + +cat << EOM >> Dockerfile + +# +# Solution begins here (from Dockerfile.solution) +# +EOM + +envsubst < Dockerfile.solution >> Dockerfile + +docker build . -t $CONTAINER diff --git a/templates/00-FROM.in b/templates/00-FROM.in new file mode 100644 index 0000000..d1de90b --- /dev/null +++ b/templates/00-FROM.in @@ -0,0 +1,6 @@ +# Creates a base OSGC Intel enabled Ubuntu image +# +# Derivatives include -dev variation which adds git, build-essentials, +# source repos, etc. +# +FROM amr-registry.caas.intel.com/vtt-osgc/os/osgc-$OS_DISTRO:$OS_RELEASE diff --git a/templates/05-intel-proxy.in b/templates/05-intel-proxy.in new file mode 100644 index 0000000..fd363ff --- /dev/null +++ b/templates/05-intel-proxy.in @@ -0,0 +1,9 @@ +# Pre-install proxy configuration values +# +# This uses the linux-ftp.ostc.intel.com as a mirror. +RUN echo "Acquire::http::proxy \"http://proxy-chain.intel.com:911/\";\n" \ + "Acquire::https::proxy \"https://proxy-chain.intel.com:911/\";\n" \ + "Acquire::ftp::proxy \"ftp://proxy-chain.intel.com:911/\";\n" \ + "Acquire::socks::proxy \"socks://proxy-chain.intel.com:1080/\";\n" \ + "Acquire::http::Proxy::linux-ftp.ostc.intel.com DIRECT;\n" \ + "Acquire::http::Proxy::osgc.jf.intel.com DIRECT;\n" > /etc/apt/apt.conf diff --git a/templates/10-default-packages.in b/templates/10-default-packages.in new file mode 100644 index 0000000..9d0d290 --- /dev/null +++ b/templates/10-default-packages.in @@ -0,0 +1,19 @@ +# Update the repo lists and then install things using the internal +# sources. Packages used by many developers are pulled into this image +# but we do want it to be relatively small. +# +# NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from +# trying to prompt for configuration details during install. +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install \ + -y --no-install-recommends -q \ + net-tools \ + iputils-ping \ + sudo \ + wget \ + locales \ + software-properties-common + +# Set up locales +RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8 +ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 diff --git a/templates/20-create-agama-user.in b/templates/20-create-agama-user.in new file mode 100644 index 0000000..bdd7911 --- /dev/null +++ b/templates/20-create-agama-user.in @@ -0,0 +1,14 @@ +# Create user 'agama' and add them to 'sudo' for sudo access and set +# the passwd to 'agama' +# +# NOTE: Requires 'sudo' package to already be installed +RUN groupadd -r agama \ +&& useradd --no-log-init \ + -s /bin/bash \ + -r -m \ + -g agama \ + -G sudo \ + -p $(echo "agama" | openssl passwd -stdin) agama + +# Set 'sudo' to NOPASSWD for all container users +RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers diff --git a/templates/25-install-agama.in b/templates/25-install-agama.in new file mode 100644 index 0000000..9feb136 --- /dev/null +++ b/templates/25-install-agama.in @@ -0,0 +1,23 @@ +# Update and install gpg-agent as it isn't in the base Ubuntu image and is needed for apt-key +RUN apt-get -q update \ + && DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -q -y install \ + gpg-agent + +# Fetch and install the signing key for OSGC's Agama repository +RUN wget --no-proxy --quiet -O /tmp/aptly.key http://osgc.jf.intel.com/packages/agama/ubuntu/aptly_repo_signing.key \ + && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add /tmp/aptly.key \ + && rm /tmp/aptly.key + +# Add internal Agama repository +RUN apt-add-repository "deb [arch=amd64] http://osgc.jf.intel.com/packages/agama/ubuntu disco main" + +# 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=$LIBGL1_MESA_GLX_VERSION libgl1-mesa-dri=$LIBGL1_MESA_DRI_VERSION \ + intel-opencl=$INTEL_OPENCL_VERSION \ + intel-media=$INTEL_MEDIA_VERSION libva2=$LIBVA2_VERSION \ + ocl-icd-libopencl1 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* +