diff --git a/Dockerfile b/Dockerfile index 1b58cbb..d768929 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,19 +7,19 @@ # of Dockerfile.solution # # Most solution specific changes should be isolated in -# Dockerfile.solution. After making changes, you can -# then re-run scripts/build-dockerfile +# Dockerfile.solution. After making changes, you can then re-run +# scripts/build-dockerfile # # -# Template from templates/templates/00-FROM.in +# Template from templates/ubuntu/00-FROM.in # # Pull from the internal cache of images FROM amr-registry.caas.intel.com/vtt-osgc/os/ubuntu:disco AS base # -# Template from templates/templates/05-intel-proxy.in +# Template from templates/ubuntu/05-intel-proxy.in # # Pre-install proxy configuration values # @@ -42,7 +42,7 @@ RUN { \ } > /etc/apt/apt.conf # -# Template from templates/templates/08-intel-certs.in +# Template from templates/ubuntu/08-intel-certs.in # # Install Intel CA5A cert so Intel certs are recognized @@ -65,7 +65,7 @@ RUN apt-get -q update \ # -# Template from templates/templates/10-default-packages.in +# Template from templates/ubuntu/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 @@ -74,7 +74,7 @@ RUN apt-get -q update \ # NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from # trying to prompt for configuration details during install. # -# pciutils is needed for lspci used by assets/agama-hw +# pciutils is needed for lspci used by assets/intel-gpu-info RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -q \ locales \ @@ -86,7 +86,7 @@ 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 from templates/templates/20-agama-packages.in +# Template from templates/ubuntu/20-agama-packages.in # FROM base AS agama @@ -101,23 +101,21 @@ FROM base AS agama # && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} # Fetch and install the signing key for repositories.intel.com -#RUN wget --no-proxy --quiet -O /tmp/repositories.key https://osgc.jf.intel.com/graphics/ubuntu/aptly_repo_signing.key \ +#RUN wget --no-proxy --quiet -O /tmp/repositories.key ${PACKAGE_KEYFILE} \ # && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add /tmp/repositories.key \ # && rm /tmp/repositories.key -# Add the repository -#RUN apt-add-repository "deb [trusted=yes arch=amd64] https://osgc.jf.intel.com/external/ubuntu disco main" +# Once the keys are being used, remove 'trusted=yes' from the repo line below: + +# Install repository as trusted until we have a signed repository: +RUN echo "deb [trusted=yes arch=amd64] https://repositories.intel.com/graphics/ubuntu disco main" > /etc/apt/sources.list.d/intel-graphics.list # Cleanup #RUN apt-get remove -y wget -# Install repository as trusted until we have a signed repository: -RUN echo "deb [trusted=yes arch=amd64] https://osgc.jf.intel.com/external/ubuntu disco main" > /etc/apt/sources.list.d/intel-graphics.list - - # -# Template from templates/templates/25-agama-user.in +# Template from templates/ubuntu/25-agama-user.in # # Create user 'agama' and add them to 'sudo' for sudo access and set # the passwd to 'agama' @@ -216,7 +214,6 @@ WORKDIR /home/agama # changes,) causing all subsequent layers to be # regenerated. - # Copy boiler plate entry point COPY assets/ /assets/ ENTRYPOINT [ "/assets/entry" ] @@ -224,6 +221,12 @@ ENTRYPOINT [ "/assets/entry" ] # Ensure that each Docker container self-documents the # versions included in it -ENV AGAMA_VERSION=N/A - -COPY MANIFEST SOLUTION Dockerfile /assets/ +RUN { \ + echo "PACKAGE_REPOSITORY=https://repositories.intel.com/graphics" ; \ + echo "RELEASE_INFO=N/A" ; \ + echo "PACKAGE_STREAM=disco" ; \ + echo "OS_DISTRO=ubuntu" ; \ + echo "OS_RELEASE=disco" ; \ +} > /assets/SOLUTION +COPY MANIFEST /assets/ +COPY Dockerfile /assets/Dockerfile diff --git a/Dockerfile.solution.rhel-8.0.0 b/Dockerfile.rhel-8.0 similarity index 87% rename from Dockerfile.solution.rhel-8.0.0 rename to Dockerfile.rhel-8.0 index 5857ba4..8bcb5e5 100644 --- a/Dockerfile.solution.rhel-8.0.0 +++ b/Dockerfile.rhel-8.0 @@ -1,3 +1,19 @@ +# +# DO NOT EDIT THIS DOCKERFILE +# +# This file is auto-generated via scripts/build-dockerfile +# by using environment substitution while concatenating the +# contents of templates/*, and then adding the contents +# of Dockerfile.solution.rhel-8.0 +# +# Most solution specific changes should be isolated in +# Dockerfile.solution.rhel-8.0. After making changes, you can then re-run +# scripts/build-dockerfile +# + +# +# Template from templates/rhel/00-everything.in +# FROM dockerv2-gfx-build.gfx-assets.intel.com/upstream/rhel:8.0.0 AS agama-user # Configure DNF and YUM proxies @@ -172,16 +188,36 @@ RUN dnf clean all \ # Agama specific content begins here # +# +# Intel certificates which would allow internal signed certs to be +# used are not being installed, so turn sslverify=0 on the +# repository. +# +# To install the certs would be something like: +# +# A. Copy ca certs to /etc/pki/ca-trust/source/anchors/ +# B. run update-ca-trust +# +# Once that is done, the 'sslverify=0' can be removed from +# the repository definition below. +# # Add Intel Graphics repository +# RUN { \ echo "[intel-graphics]" ; \ echo "name=Intel Graphics Drivers Repository" ; \ - echo "baseurl=https://osgc.jf.intel.com/internal/rhel/8.0/" ; \ + echo "baseurl=https://repositories.intel.com/graphics/rhel/8.0/" ; \ echo "sslverify=0" ; \ echo "enabled=1" ; \ echo "gpgcheck=0" ; \ } > /etc/yum.repos.d/intel-graphics.repo +# Disable proxy for Intel URLs +RUN echo "no_proxy=.jf.intel.com" >> /etc/yum.conf + +# +# Solution begins here (from Dockerfile.solution.rhel-8.0) +# # 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 @@ -197,7 +233,7 @@ RUN dnf groupinstall -y 'Development Tools' # 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 /ffmpeg +RUN git clone --depth 1 --branch n4.2.1 https://github.com/ffmpeg/ffmpeg /ffmpeg # Install all required common packages: # Adapted from @@ -237,7 +273,13 @@ RUN dnf install -y \ # Copy ffmpeg and ffprobe from build container COPY --from=solution-build /usr/local/bin/ /usr/local/bin/ -WORKDIR /home/agama +# +# 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. # Copy boiler plate entry point COPY assets/ /assets/ @@ -246,6 +288,12 @@ ENTRYPOINT [ "/assets/entry" ] # Ensure that each Docker container self-documents the # versions included in it -ENV AGAMA_VERSION=${AGAMA_VERSION} - -COPY MANIFEST SOLUTION Dockerfile /assets/ +RUN { \ + echo "PACKAGE_REPOSITORY=https://repositories.intel.com/graphics" ; \ + echo "RELEASE_INFO=N/A" ; \ + echo "PACKAGE_STREAM=8.0" ; \ + echo "OS_DISTRO=rhel" ; \ + echo "OS_RELEASE=8.0" ; \ +} > /assets/SOLUTION +COPY MANIFEST /assets/ +COPY Dockerfile.rhel-8.0 /assets/Dockerfile diff --git a/Dockerfile.solution.rhel-8.0 b/Dockerfile.solution.rhel-8.0 new file mode 100644 index 0000000..1f1062a --- /dev/null +++ b/Dockerfile.solution.rhel-8.0 @@ -0,0 +1,54 @@ +# 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 +FROM agama-user AS solution-build + +# Install git and build tools, clone ffmpeg, and get ready to build it +RUN dnf groupinstall -y 'Development Tools' + +# 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 /ffmpeg + +# Install all required common packages: +# Adapted from +RUN dnf install -y \ + libva-devel$LIBVA_DEV_VERSION \ + intel-mediasdk-devel$INTEL_MEDIASDK_DEVEL_VERSION \ + libva-utils$LIBVA_UTILS_VERSION \ + && dnf clean all + +ENV LIBVA_DRIVER_NAME=iHD + +# Build FFmpeg +WORKDIR /ffmpeg + +RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \ + && make -j $(nproc --all) \ + && make install + +FROM agama-user + +ENV LIBVA_DRIVER_NAME=iHD + +# Update and install the Mesa, OpenCL, and Media from Agama +# +# NOTE: libva requires libpciaccess0, however it doesn't depend on it +# so explicitly install it. +# intel-media-va-driver-non-free$INTEL_MEDIA_VA_DRIVER_NON_FREE_VERSION \ +RUN dnf install -y \ + intel-media$INTEL_MEDIA_VERSION \ + libva$LIBVA_VERSION \ + intel-mediasdk$INTEL_MEDIASDK_VERSION \ + libva-utils$LIBVA_UTILS_VERSION \ + libpciaccess \ + pciutils \ + && dnf clean all + +# Copy ffmpeg and ffprobe from build container +COPY --from=solution-build /usr/local/bin/ /usr/local/bin/ diff --git a/README.md b/README.md index 2c5654e..baf3e03 100644 --- a/README.md +++ b/README.md @@ -14,25 +14,47 @@ being a minimal run-time installation on top of the base OS. You can pull the container from Harbor: ```bash -docker pull amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg -docker tag amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg intel-media-ffmpeg +export OS_DISTRO=ubuntu +export PACKAGE_STREAM=disco +TAG=${OS_DISTRO}-${PACKAGE_STREAM} +docker pull amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg:${TAG} +docker tag amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg:${TAG} intel-media-ffmpeg ``` -or build it yourself: +### Build Ubuntu container ```bash -docker build . -t intel-media-ffmpeg +export OS_DISTRO=ubuntu +export OS_RELEASE=disco +export PACKAGE_STREAM=disco +export PACKAGE_REPOSITORY=https://repositories.intel.com/graphics +export TAG=test-build-${OS_DISTRO}-${PACKAGE_STREAM}-$(date +%Y%m%d) +scripts/build-dockerfile +scripts/build-images +``` + +### Build Red Hat container + +```bash +export OS_DISTRO=rhel +export OS_RELEASE=8.0 +export PACKAGE_STREAM=8.0 +export PACKAGE_REPOSITORY=https://repositories.intel.com/graphics +export TAG=test-build-${OS_DISTRO}-${PACKAGE_STREAM}-$(date +%Y%m%d) +scripts/build-dockerfile +scripts/build-images ``` ## Verify hardware access ```bash +TAG=${TAG:-latest} docker run \ --rm \ --device=/dev/dri \ -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \ -it \ - intel-media-ffmpeg \ + intel-media-ffmpeg:${TAG} \ info ``` @@ -52,6 +74,7 @@ NOTE: The test media stream is currently hard coded to expect the name AUD_WM_E.264 in the container. ```bash +TAG=${TAG:-latest} mkdir $(pwd)/media wget -O $(pwd)/media/AUD_MW_E.264 \ https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264 @@ -61,7 +84,7 @@ docker run \ -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \ --volume $(pwd)/media:/media \ -it \ - intel-media-ffmpeg \ + intel-media-ffmpeg:${TAG} \ test ``` @@ -91,12 +114,13 @@ AUD_1N-4M60FPS.h264 The examples below are all assumed to be running in the container's environment: ```bash +TAG=${TAG:-latest} docker run \ --rm \ --device=/dev/dri \ -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \ -it \ - intel-media-ffmpeg \ + intel-media-ffmpeg:${TAG} \ shell ``` diff --git a/README.rhel-8.0.0 b/README.rhel-8.0.0 deleted file mode 100644 index 69eb604..0000000 --- a/README.rhel-8.0.0 +++ /dev/null @@ -1,48 +0,0 @@ -# Build the Red Hat 8.0 version... - -The Red Hat image isn't using the templates/* -- it was built as a POC to -verify that our repositories are working correctly for Red Hat. - -```bash -TAG=test-build-rhel-8.0.0-$(date +%Y%m%d) -export $(grep ^FFMPEG SOLUTION) -envsubst < Dockerfile.solution.rhel-8.0.0 > Dockerfile.rhel-8.0.0 -docker build -f Dockerfile.rhel-8.0.0 -t intel-media-ffmpeg:${TAG} --no-cache . -``` - -# To push the tag to Harbor -```bash -TAG=test-build-rhel-8.0.0-$(date +%Y%m%d) -docker tag intel-media-ffmpeg:${TAG} amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg:${TAG} -docker push amr-registry.caas.intel.com/vtt-osgc/solutions/intel-media-ffmpeg:${TAG} -``` - -# In a custom image... - -## Installing certificates - -This image isn't yet copying certificates which would -allow internal signed certs to be used, so turn -sslverify=0 on the repository. - -To install the certs would be something like: - -A. Copy ca certs to /etc/pki/ca-trust/source/anchors/ -B. run update-ca-trust - -## Installing the Intel Graphics Driver repository for Red Hat 8.0 - -cat << EOF > /etc/yum.repos.d/intel-graphics.repo -[intel-graphics] -name=Intel Graphics Drivers Repository -baseurl=https://osgc.jf.intel.com/graphics/rhel/8.0-devel/ -sslverify=0 -enabled=1 -gpgcheck=0 -EOF - -## Configure YUM to not use the proxy for .intel.com domains -echo "no_proxy=.jf.intel.com" >> /etc/yum.conf - -## Install some packages -dnf install intel-opencl diff --git a/SOLUTION b/SOLUTION index ccd8253..ca02e39 100644 --- a/SOLUTION +++ b/SOLUTION @@ -1,11 +1,11 @@ FFMPEG_TAG_VERSION=n4.2.1 +RELEASE_INFO=${RELEASE_INFO:-N/A} + REPO_URL=${REPO_URL:-amr-registry.caas.intel.com/vtt-osgc/solutions} CONTAINER=$(basename ${PWD}) OS_DISTRO=${OS_DISTRO:-ubuntu} OS_RELEASE=${OS_RELEASE:-disco} -#PACKAGE_STREAM=${PACKAGE_STREAM:-${OS_RELEASE}-devel} PACKAGE_STREAM=${PACKAGE_STREAM:-${OS_RELEASE}} -PACKAGE_KEYFILE=https://osgc.jf.intel.com/graphics/ubuntu/aptly_repo_signing.key -PACKAGE_REPOSITORY=https://osgc.jf.intel.com/external/${OS_DISTRO} -#PACKAGE_KEYFILE=https://repositories.intel.com/graphics/ubuntu/repository.key -#PACKAGE_REPOSITORY=https://repositories.intel.com/graphics/${OS_DISTRO} +#PACKAGE_STREAM=${PACKAGE_STREAM:-${OS_RELEASE}-devel} +PACKAGE_REPOSITORY=${PACKAGE_REPOSITORY:-https://repositories.intel.com/graphics} +#PACKAGE_KEYFILE=https://repositories.intel.com/graphics/repository.key diff --git a/assets/entry b/assets/entry index f024a3e..600f11d 100755 --- a/assets/entry +++ b/assets/entry @@ -1,20 +1,16 @@ #!/bin/bash -# Pull off any 'entry' options -options=() arguments=() for arg in "$@"; do - (( ${#arguments[@]} == 0 )) && [[ "${arg}" =~ ^--.* ]] && { - options+=(${arg##--}) - } || { - arguments+=($arg) - } + arguments+=($arg) done +# First argument is the command request=${arguments[0]} +# Rest of the arguments arguments=("${arguments[@]:1}") -commands=(info help version ffmpeg shell) +commands=(info help version shell) commands+=(/assets/commands/*) . /assets/SOLUTION @@ -29,7 +25,7 @@ EOF } info() { - HW=$(/assets/agama-hw) + HW=$(/assets/intel-gpu-info) [ $? ] || { HW="None" } @@ -39,9 +35,11 @@ info() { cat << EOF $(name) -Detected base OS: Ubuntu 19.04 -Detected hardware: ${HW} -Detected Agama version: ${AGAMA_VERSION} +Container base OS : ${OS_DISTRO} ${OS_RELEASE} +Release information: ${RELEASE_INFO} +Detected hardware : ${HW} +Package repository : ${PACKAGE_REPOSITORY} +Package stream : ${OS_DISTRO}-${PACKAGE_STREAM} EOF } @@ -67,20 +65,12 @@ version() { echo "Show container version information" } || { cat << EOF -$CONTAINER built using Agama $AGAMA_VERSION. +${CONTAINER} version ${RELEASE_INFO}. EOF } } -ffmpeg() { - [ "$1" == "--short" ] && { - echo "Run ffmpeg commands." - } || { - /usr/local/bin/ffmpeg "${@}" - } -} - help() { [ "$1" == "--short" ] && { echo "This help information" @@ -98,16 +88,6 @@ EOF echo "" } -badOption() { -cat << EOF -$(name) - -Error: Unrecognized option: $1 - -EOF - exit 3 -} - [[ "${request}" == "" ]] && { request="help" } @@ -117,22 +97,9 @@ EOF exit $? } -for option in "${options[@]}"; do - case $option in - debug) debug=1 - ;; - *) unrecognizedOption $option - ;; - esac -done - [ ! -f /assets/commands/$request ] && { - echo "'${request}' is not a recognized command." + shell "${request}" "${arguments[@]}" } || { - (( $debug )) && { - /bin/bash -x /assets/commands/$request "${arguments[@]}" - } || { - /assets/commands/$request "${arguments[@]}" - } + /assets/commands/$request "${arguments[@]}" exit $? } diff --git a/assets/agama-hw b/assets/intel-gpu-info similarity index 100% rename from assets/agama-hw rename to assets/intel-gpu-info diff --git a/scripts/build-dockerfile b/scripts/build-dockerfile index ad4ec22..26d228d 100755 --- a/scripts/build-dockerfile +++ b/scripts/build-dockerfile @@ -17,6 +17,24 @@ for var in ${VARS[@]}; do export ${var} done +case "${OS_DISTRO}" in + rhel) + SOLUTION_SUFFIX=".rhel-8.0" + ;; + ubuntu) + SOLUTION_SUFFIX="" + ;; + *) + echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'" + exit -1 + ;; +esac + +export DOCKERFILE="Dockerfile${SOLUTION_SUFFIX}" +export SOLUTION="Dockerfile.solution${SOLUTION_SUFFIX}" +VARS+=("DOCKERFILE") +VARS+=("SOLUTION") + # Build a SHELL-FORMAT value to pass to envsubst. # Only those variables matched in SHELL-FORMAT will # be escaped by envsubst. @@ -28,55 +46,57 @@ done # Remove the Dockerfile if it exists; should check # if it is clean first, and abort if not. # -[ -e Dockerfile ] && rm Dockerfile +[ -e ${DOCKERFILE} ] && rm ${DOCKERFILE} -cat << EOM > Dockerfile +cat << EOM > ${DOCKERFILE} # # DO NOT EDIT THIS DOCKERFILE # # This file is auto-generated via scripts/build-dockerfile # by using environment substitution while concatenating the # contents of templates/*, and then adding the contents -# of Dockerfile.solution +# of ${SOLUTION} # # Most solution specific changes should be isolated in -# Dockerfile.solution. After making changes, you can -# then re-run scripts/build-dockerfile +# ${SOLUTION}. After making changes, you can then re-run +# scripts/build-dockerfile # EOM -for snippet in templates/??-*.in; do - cat << EOM >> Dockerfile +for snippet in templates/${OS_DISTRO}/??-*.in; do + cat << EOM >> ${DOCKERFILE} # -# Template from templates/${snippet} +# Template from ${snippet} # EOM - envsubst ${ENV} < $snippet >> Dockerfile + envsubst ${ENV} < $snippet >> ${DOCKERFILE} done -cat << EOM >> Dockerfile +cat << EOM >> ${DOCKERFILE} # -# Solution begins here (from Dockerfile.solution) +# Solution begins here (from ${SOLUTION}) # EOM -envsubst ${ENV} < Dockerfile.solution >> Dockerfile +envsubst ${ENV} < ${SOLUTION} >> ${DOCKERFILE} -cat << EOM >> Dockerfile +cat << EOM >> ${DOCKERFILE} # # Standard ending begins here (from templates/ending.in) # EOM -envsubst ${ENV} < templates/ending.in >> Dockerfile +envsubst ${ENV} < templates/ending.in >> ${DOCKERFILE} cat << EOM -Dockerfile has been updated. +${DOCKERFILE} has been updated. -To build the image, you can run scripts/build-images +To build the image, you can run: + + OS_DISTRO=${OS_DISTRO} OS_RELEASE=${OS_RELEASE} scripts/build-images EOM diff --git a/scripts/build-images b/scripts/build-images index 8a06fef..0fa215d 100755 --- a/scripts/build-images +++ b/scripts/build-images @@ -21,23 +21,39 @@ AGAMA_VERSION=${AGAMA_VERSION:-N/A} TAG=${TAG:-test-agama-${AGAMA_VERSION}} } -docker build -t ${CONTAINER}:${TAG} . $* || { +case "${OS_DISTRO}" in + rhel) + SOLUTION_SUFFIX=".rhel-8.0" + ;; + ubuntu) + SOLUTION_SUFFIX="" + ;; + *) + echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'" + exit -1 + ;; +esac + +export DOCKERFILE="Dockerfile${SOLUTION_SUFFIX}" +export SOLUTION="Dockerfile.solution${SOLUTION_SUFFIX}" + +docker build -t ${CONTAINER}:${TAG} -f ${DOCKERFILE} . $* || { cat << EOM -Building docker image failed. +Building docker image from ${DOCKERFILE} failed. EOM - exit $? + exit -1 } -docker tag ${CONTAINER}:${TAG} ${CONTAINER} -rc=$? -if [ $rc -ne 0 ]; then - exit 1 -fi +docker tag ${CONTAINER}:${TAG} ${CONTAINER} || { + echo "Unable to tag docker image" + exit -1 +} cat << EOM -This image was built and locally tagged as ${CONTAINER}:${TAG} + +${DOCKERFILE} was built and locally tagged as ${CONTAINER}:${TAG} See 'scripts/push-images' for information on pushing this tag to Harbor. diff --git a/scripts/push-images b/scripts/push-images index 137b19a..0978053 100755 --- a/scripts/push-images +++ b/scripts/push-images @@ -22,16 +22,20 @@ AGAMA_VERSION=${AGAMA_VERSION:-N/A} } docker tag ${CONTAINER}:${TAG} ${REPO_URL}/${CONTAINER}:${TAG} \ -&& docker push ${REPO_URL}/${CONTAINER}:${TAG} \ -|| exit 1 + && docker push ${REPO_URL}/${CONTAINER}:${TAG} \ + || { + echo "Unable to tag and push image to ${REPO_URL}." + exit 1 +} -cat << EOM +[[ "${TAG}" =~ "test-*" ]] && { + cat << EOM This image was pushed with the 'test-' tag prefix: amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:${TAG} -If the build looks good, you can promote this build: +If the image looks good, you can promote this build: 1. Tag the tree it as ${TAG} @@ -49,3 +53,13 @@ If the build looks good, you can promote this build: docker push amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:latest-${PACKAGE_STREAM} EOM +} || { + cat << EOM + +This image was pushed: + + amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:${TAG} + +EOM +} + diff --git a/templates/ending.in b/templates/ending.in index 3ea4036..30c5c96 100644 --- a/templates/ending.in +++ b/templates/ending.in @@ -3,7 +3,6 @@ # changes,) causing all subsequent layers to be # regenerated. - # Copy boiler plate entry point COPY assets/ /assets/ ENTRYPOINT [ "/assets/entry" ] @@ -11,6 +10,12 @@ ENTRYPOINT [ "/assets/entry" ] # Ensure that each Docker container self-documents the # versions included in it -ENV AGAMA_VERSION=${AGAMA_VERSION} - -COPY MANIFEST SOLUTION Dockerfile /assets/ +RUN { \ + echo "PACKAGE_REPOSITORY=${PACKAGE_REPOSITORY}" ; \ + echo "RELEASE_INFO=${RELEASE_INFO}" ; \ + echo "PACKAGE_STREAM=${PACKAGE_STREAM}" ; \ + echo "OS_DISTRO=${OS_DISTRO}" ; \ + echo "OS_RELEASE=${OS_RELEASE}" ; \ +} > /assets/SOLUTION +COPY MANIFEST /assets/ +COPY ${DOCKERFILE} /assets/Dockerfile diff --git a/Dockerfile.rhel-8.0.0 b/templates/rhel/00-everything.in similarity index 84% rename from Dockerfile.rhel-8.0.0 rename to templates/rhel/00-everything.in index dd76004..85d719c 100644 --- a/Dockerfile.rhel-8.0.0 +++ b/templates/rhel/00-everything.in @@ -172,80 +172,29 @@ RUN dnf clean all \ # Agama specific content begins here # +# +# Intel certificates which would allow internal signed certs to be +# used are not being installed, so turn sslverify=0 on the +# repository. +# +# To install the certs would be something like: +# +# A. Copy ca certs to /etc/pki/ca-trust/source/anchors/ +# B. run update-ca-trust +# +# Once that is done, the 'sslverify=0' can be removed from +# the repository definition below. +# # Add Intel Graphics repository +# RUN { \ echo "[intel-graphics]" ; \ echo "name=Intel Graphics Drivers Repository" ; \ - echo "baseurl=https://osgc.jf.intel.com/internal/rhel/8.0/" ; \ + echo "baseurl=${PACKAGE_REPOSITORY}/${OS_DISTRO}/${PACKAGE_STREAM}/" ; \ echo "sslverify=0" ; \ echo "enabled=1" ; \ echo "gpgcheck=0" ; \ } > /etc/yum.repos.d/intel-graphics.repo -# 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 -FROM agama-user AS solution-build - -# Install git and build tools, clone ffmpeg, and get ready to build it -RUN dnf groupinstall -y 'Development Tools' - -# 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 /ffmpeg - -# Install all required common packages: -# Adapted from -RUN dnf install -y \ - libva-devel \ - intel-mediasdk-devel \ - libva-utils \ - && dnf clean all - -ENV LIBVA_DRIVER_NAME=iHD - -# Build FFmpeg -WORKDIR /ffmpeg - -RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \ - && make -j $(nproc --all) \ - && make install - -FROM agama-user - -ENV LIBVA_DRIVER_NAME=iHD - -# Update and install the Mesa, OpenCL, and Media from Agama -# -# NOTE: libva requires libpciaccess0, however it doesn't depend on it -# so explicitly install it. -# intel-media-va-driver-non-free \ -RUN dnf install -y \ - intel-media \ - libva \ - intel-mediasdk \ - libva-utils \ - libpciaccess \ - pciutils \ - && dnf clean all - -# Copy ffmpeg and ffprobe from build container -COPY --from=solution-build /usr/local/bin/ /usr/local/bin/ - -WORKDIR /home/agama - -# Copy boiler plate entry point -COPY assets/ /assets/ -ENTRYPOINT [ "/assets/entry" ] - -# Ensure that each Docker container self-documents the -# versions included in it - -ENV AGAMA_VERSION= - -COPY MANIFEST SOLUTION Dockerfile /assets/ +# Disable proxy for Intel URLs +RUN echo "no_proxy=.jf.intel.com" >> /etc/yum.conf diff --git a/templates/00-FROM.in b/templates/ubuntu/00-FROM.in similarity index 100% rename from templates/00-FROM.in rename to templates/ubuntu/00-FROM.in diff --git a/templates/05-intel-proxy.in b/templates/ubuntu/05-intel-proxy.in similarity index 100% rename from templates/05-intel-proxy.in rename to templates/ubuntu/05-intel-proxy.in diff --git a/templates/ubuntu/05-intel-proxy.in.orig b/templates/ubuntu/05-intel-proxy.in.orig new file mode 100644 index 0000000..3d1e238 --- /dev/null +++ b/templates/ubuntu/05-intel-proxy.in.orig @@ -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 \"http://proxy-chain.intel.com:912/\";\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/08-intel-certs.in b/templates/ubuntu/08-intel-certs.in similarity index 100% rename from templates/08-intel-certs.in rename to templates/ubuntu/08-intel-certs.in diff --git a/templates/10-default-packages.in b/templates/ubuntu/10-default-packages.in similarity index 91% rename from templates/10-default-packages.in rename to templates/ubuntu/10-default-packages.in index 56dffb9..5250e6f 100644 --- a/templates/10-default-packages.in +++ b/templates/ubuntu/10-default-packages.in @@ -5,7 +5,7 @@ # NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from # trying to prompt for configuration details during install. # -# pciutils is needed for lspci used by assets/agama-hw +# pciutils is needed for lspci used by assets/intel-gpu-info RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -q \ locales \ diff --git a/templates/20-agama-packages.in b/templates/ubuntu/20-agama-packages.in similarity index 74% rename from templates/20-agama-packages.in rename to templates/ubuntu/20-agama-packages.in index c406fde..6f6aa94 100644 --- a/templates/20-agama-packages.in +++ b/templates/ubuntu/20-agama-packages.in @@ -15,13 +15,11 @@ FROM base AS agama # && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add /tmp/repositories.key \ # && rm /tmp/repositories.key -# Add the repository -#RUN apt-add-repository "deb [trusted=yes arch=amd64] ${PACKAGE_REPOSITORY} ${OS_RELEASE} main" +# Once the keys are being used, remove 'trusted=yes' from the repo line below: + +# Install repository as trusted until we have a signed repository: +RUN echo "deb [trusted=yes arch=amd64] ${PACKAGE_REPOSITORY}/${OS_DISTRO} ${PACKAGE_STREAM} main" > /etc/apt/sources.list.d/intel-graphics.list # Cleanup #RUN apt-get remove -y wget -# Install repository as trusted until we have a signed repository: -RUN echo "deb [trusted=yes arch=amd64] ${PACKAGE_REPOSITORY} ${PACKAGE_STREAM} main" > /etc/apt/sources.list.d/intel-graphics.list - - diff --git a/templates/25-agama-user.in b/templates/ubuntu/25-agama-user.in similarity index 100% rename from templates/25-agama-user.in rename to templates/ubuntu/25-agama-user.in