diff --git a/Dockerfile b/Dockerfile index dfa8b9f..e24f91f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -82,35 +82,6 @@ RUN apt-get -q update \ 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/ubuntu/20-agama-packages.in -# -FROM base AS agama - -# Once we have a signed repository: -# -# 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 \ -# wget \ -# gpg-agent \ -# && apt-get clean \ -# && 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 ${PACKAGE_KEYFILE} \ -# && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add /tmp/repositories.key \ -# && rm /tmp/repositories.key - -# 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 - - # # Template from templates/ubuntu/20-repositories-intel-com.in # @@ -146,32 +117,6 @@ RUN echo "deb [trusted=yes arch=amd64] https://repositories.intel.com/graphics/u #RUN apt-get remove -y wget -# -# 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' - -FROM agama AS agama-user - -RUN apt-get -q update \ - && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ - sudo \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} - -# 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 from templates/ubuntu/25-graphics-user.in # @@ -219,7 +164,7 @@ RUN apt-get update \ # 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/graphics/ffmpeg +RUN git clone --depth 1 --branch n4.2.1 https://github.com/ffmpeg/ffmpeg /home/graphics/ffmpeg # Install all required common packages: RUN apt-get update \ diff --git a/Dockerfile.rhel-8.0 b/Dockerfile.rhel-8.0 index 8bcb5e5..e5d1962 100644 --- a/Dockerfile.rhel-8.0 +++ b/Dockerfile.rhel-8.0 @@ -14,7 +14,7 @@ # # Template from templates/rhel/00-everything.in # -FROM dockerv2-gfx-build.gfx-assets.intel.com/upstream/rhel:8.0.0 AS agama-user +FROM dockerv2-gfx-build.gfx-assets.intel.com/upstream/rhel:8.0.0 AS user-stage # Configure DNF and YUM proxies RUN echo "proxy=http://proxy-chain.intel.com:911" >> /etc/dnf/dnf.conf \ @@ -186,9 +186,8 @@ RUN dnf clean all \ && dnf -y upgrade \ && dnf clean all -# Agama specific content begins here +# repositories.intel.com 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. @@ -226,7 +225,7 @@ RUN echo "no_proxy=.jf.intel.com" >> /etc/yum.conf # 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 +FROM user-stage AS solution-build # Install git and build tools, clone ffmpeg, and get ready to build it RUN dnf groupinstall -y 'Development Tools' @@ -252,11 +251,11 @@ RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \ && make -j $(nproc --all) \ && make install -FROM agama-user +FROM user-stage ENV LIBVA_DRIVER_NAME=iHD -# Update and install the Mesa, OpenCL, and Media from Agama +# Update and install the Mesa, OpenCL, and Media from repositories.intel.com # # NOTE: libva requires libpciaccess0, however it doesn't depend on it # so explicitly install it. diff --git a/README.md b/README.md index baf3e03..ed88889 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ 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 +scripts/build-dockerfile.sh +scripts/build-image.sh ``` ### Build Red Hat container @@ -41,8 +41,8 @@ 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 +scripts/build-dockerfile.sh +scripts/build-image.sh ``` ## Verify hardware access diff --git a/assets/commands/.keep b/assets/commands/.keep new file mode 100644 index 0000000..e69de29 diff --git a/scripts/build-dockerfile b/scripts/build-dockerfile.sh similarity index 86% rename from scripts/build-dockerfile rename to scripts/build-dockerfile.sh index 26d228d..5ca2b6d 100755 --- a/scripts/build-dockerfile +++ b/scripts/build-dockerfile.sh @@ -25,8 +25,14 @@ case "${OS_DISTRO}" in SOLUTION_SUFFIX="" ;; *) - echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'" - exit -1 + SOLUTION_SUFFIX=".${OS_DISTRO}-${OS_RELEASE}" + [[ -d "templates/${OS_DISTRO}" ]] || { + echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'" + exit -1 + } + [[ ! -e "Dockerfile.solution.${SOLUTION_SUFFIX}" ]] && { + SOLUTION_SUFFIX="" + } ;; esac @@ -35,6 +41,8 @@ export SOLUTION="Dockerfile.solution${SOLUTION_SUFFIX}" VARS+=("DOCKERFILE") VARS+=("SOLUTION") +echo "Using '${SOLUTION}' to generate '${DOCKERFILE}'." + # Build a SHELL-FORMAT value to pass to envsubst. # Only those variables matched in SHELL-FORMAT will # be escaped by envsubst. @@ -97,6 +105,6 @@ ${DOCKERFILE} has been updated. To build the image, you can run: - OS_DISTRO=${OS_DISTRO} OS_RELEASE=${OS_RELEASE} scripts/build-images + OS_DISTRO=${OS_DISTRO} OS_RELEASE=${OS_RELEASE} scripts/build-image.sh EOM diff --git a/scripts/build-images b/scripts/build-image.sh similarity index 71% rename from scripts/build-images rename to scripts/build-image.sh index 0fa215d..89c9f1e 100755 --- a/scripts/build-images +++ b/scripts/build-image.sh @@ -14,11 +14,11 @@ fi export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION | ${CMD} -d '\n') export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" MANIFEST | ${CMD} -d '\n') -AGAMA_VERSION=${AGAMA_VERSION:-N/A} -[[ "${AGAMA_VERSION}" == "N/A" ]] && { +RELEASE_INFO=${RELEASE_INFO:-N/A} +[[ "${RELEASE_INFO}" == "N/A" ]] && { TAG=${TAG:-test-build-${PACKAGE_STREAM}-$(date +%Y%m%d)} } || { - TAG=${TAG:-test-agama-${AGAMA_VERSION}} + TAG=${TAG:-test-${RELEASE_INFO}} } case "${OS_DISTRO}" in @@ -29,14 +29,23 @@ case "${OS_DISTRO}" in SOLUTION_SUFFIX="" ;; *) - echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'" - exit -1 + SOLUTION_SUFFIX=".${OS_DISTRO}-${OS_RELEASE}" + [[ -d "templates/${OS_DISTRO}" ]] || { + echo "Unrecognized OS_DISTRO: '${OS_DISTRO}'" + exit -1 + } + [[ ! -e "Dockerfile.solution.${SOLUTION_SUFFIX}" ]] && { + SOLUTION_SUFFIX="" + } ;; esac export DOCKERFILE="Dockerfile${SOLUTION_SUFFIX}" export SOLUTION="Dockerfile.solution${SOLUTION_SUFFIX}" +echo "Building '${SOLUTION}' image from '${DOCKERFILE}'" + + docker build -t ${CONTAINER}:${TAG} -f ${DOCKERFILE} . $* || { cat << EOM diff --git a/scripts/push-images b/scripts/push-image.sh similarity index 59% rename from scripts/push-images rename to scripts/push-image.sh index 0978053..9ce3d3b 100755 --- a/scripts/push-images +++ b/scripts/push-image.sh @@ -14,11 +14,11 @@ fi export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" SOLUTION | ${CMD} -d '\n') export $(sed -nE "s,(^[^#][^=]*).*$,\1,pg" MANIFEST | ${CMD} -d '\n') -AGAMA_VERSION=${AGAMA_VERSION:-N/A} -[[ "${AGAMA_VERSION}" == "N/A" ]] && { +RELEASE_INFO=${RELEASE_INFO:-N/A} +[[ "${RELEASE_INFO}" == "N/A" ]] && { TAG=${TAG:-test-build-${PACKAGE_STREAM}-$(date +%Y%m%d)} } || { - TAG=${TAG:-test-agama-${PACKAGE_STREAM}-${AGAMA_VERSION}} + TAG=${TAG:-test-${RELEASE_INFO}} } docker tag ${CONTAINER}:${TAG} ${REPO_URL}/${CONTAINER}:${TAG} \ @@ -33,7 +33,7 @@ docker tag ${CONTAINER}:${TAG} ${REPO_URL}/${CONTAINER}:${TAG} \ This image was pushed with the 'test-' tag prefix: - amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:${TAG} + ${REGISTRY_URL}/${CONTAINER}:${TAG} If the image looks good, you can promote this build: @@ -44,13 +44,13 @@ If the image looks good, you can promote this build: 2. Remove the 'test-' prefix from the tag: - docker tag ${CONTAINER}:${TAG/test-} amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:${TAG/test-} - docker push amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:${TAG/test-} + docker tag ${CONTAINER}:${TAG/test-} ${REGISTRY_URL}/${CONTAINER}:${TAG/test-} + docker push ${REGISTRY_URL}/${CONTAINER}:${TAG/test-} 3. Roll this version to the 'latest': - docker tag ${CONTAINER}:${TAG/test-} amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:latest-${PACKAGE_STREAM} - docker push amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:latest-${PACKAGE_STREAM} + docker tag ${CONTAINER}:${TAG/test-} ${REGISTRY_URL}/${CONTAINER}:latest-${PACKAGE_STREAM} + docker push ${REGISTRY_URL}/${CONTAINER}:latest-${PACKAGE_STREAM} EOM } || { @@ -58,7 +58,7 @@ EOM This image was pushed: - amr-registry.caas.intel.com/vtt-osgc/solutions/${CONTAINER}:${TAG} + ${REGISTRY_URL}/${CONTAINER}:${TAG} EOM } diff --git a/templates/centos/00-everything.in b/templates/centos/00-everything.in new file mode 100644 index 0000000..dda38d7 --- /dev/null +++ b/templates/centos/00-everything.in @@ -0,0 +1,39 @@ +# Pull $OS_DISTRO from Docker Hub +FROM $OS_DISTRO:$OS_RELEASE as user-stage + +# Configure DNF and YUM proxies +RUN echo "proxy=http://proxy-chain.intel.com:911" >> /etc/dnf/dnf.conf \ + && echo -e 'proxy=http://proxy-chain.intel.com:911\nno_proxy=.intel.com' >> /etc/yum.conf + +# Update package lists, and upgrade to the latest Red Hat packages +RUN dnf clean all \ + && dnf -y upgrade \ + && dnf clean all + +# repositories.intel.com 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=${PACKAGE_REPOSITORY}/${OS_DISTRO}/${PACKAGE_STREAM}/" ; \ + 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 diff --git a/templates/ubuntu/20-agama-packages.in b/templates/ubuntu/20-repositories-intel-com.in similarity index 69% rename from templates/ubuntu/20-agama-packages.in rename to templates/ubuntu/20-repositories-intel-com.in index 6f6aa94..d802dd6 100644 --- a/templates/ubuntu/20-agama-packages.in +++ b/templates/ubuntu/20-repositories-intel-com.in @@ -1,21 +1,27 @@ -FROM base AS agama +FROM base AS pre-user # Once we have a signed repository: # -# Update and install gpg-agent as it isn't in the base Ubuntu image and is needed for apt-key +# 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 \ -# wget \ -# gpg-agent \ +# && DEBIAN_FRONTEND=noninteractive \ +# apt-get --no-install-recommends -q -y install \ +# wget \ +# gpg-agent \ # && apt-get clean \ # && 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 ${PACKAGE_KEYFILE} \ -# && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key add /tmp/repositories.key \ +# && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn \ +# apt-key add /tmp/repositories.key \ # && rm /tmp/repositories.key -# Once the keys are being used, remove 'trusted=yes' from the repo line below: +# 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 diff --git a/templates/ubuntu/25-agama-user.in b/templates/ubuntu/25-graphics-user.in similarity index 65% rename from templates/ubuntu/25-agama-user.in rename to templates/ubuntu/25-graphics-user.in index 8422a19..4229143 100644 --- a/templates/ubuntu/25-agama-user.in +++ b/templates/ubuntu/25-graphics-user.in @@ -1,7 +1,7 @@ -# Create user 'agama' and add them to 'sudo' for sudo access and set -# the passwd to 'agama' +# Create user 'graphics' and add them to 'sudo' for sudo access and set +# the passwd to 'graphics' -FROM agama AS agama-user +FROM graphics AS user-stage RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ @@ -10,13 +10,13 @@ RUN apt-get -q update \ && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} # NOTE: Requires 'sudo' package to already be installed -RUN groupadd -r agama \ +RUN groupadd -r graphics \ && useradd --no-log-init \ -s /bin/bash \ -r -m \ - -g agama \ + -g graphics \ -G sudo \ - -p $(echo "agama" | openssl passwd -stdin) agama + -p $(echo "graphics" | openssl passwd -stdin) graphics # Set 'sudo' to NOPASSWD for all container users RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers