235 lines
6.2 KiB
Docker
235 lines
6.2 KiB
Docker
# syntax=docker/dockerfile:1.2
|
|
# Enable secrets
|
|
#
|
|
# 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
|
|
#
|
|
# Most solution specific changes should be isolated in
|
|
# Dockerfile.solution. After making changes, you can then re-run
|
|
# scripts/build-dockerfile
|
|
#
|
|
|
|
#
|
|
# Template from templates/centos/00-from.in
|
|
#
|
|
# Pull centos from Docker Hub
|
|
FROM amr-registry.caas.intel.com/vtt-osgc/os/centos:8.2 as xe-base-stage
|
|
|
|
# Flush cached package lists to prevent stale data
|
|
RUN dnf clean all
|
|
|
|
|
|
#
|
|
# Template from templates/centos/05-intel-proxy.in
|
|
#
|
|
# Configure Intel proxy values
|
|
|
|
ARG http_proxy="http://proxy-chain.intel.com:911/"
|
|
ARG https_proxy="http://proxy-chain.intel.com:912/"
|
|
ARG ftp_proxy="ftp://proxy-chain.intel.com:911/"
|
|
ARG socks_proxy="socks://proxy-chain.intel.com:1080/"
|
|
ARG no_proxy="localhost,*.*.intel.com"
|
|
|
|
ENV http_proxy="${http_proxy}"
|
|
ENV https_proxy="${https_proxy}"
|
|
ENV no_proxy="${no_proxy}"
|
|
ENV ftp_proxy="${http_proxy}"
|
|
ENV socks_proxy="${socks_proxy}"
|
|
|
|
ENV HTTP_PROXY="${http_proxy}"
|
|
ENV HTTPS_PROXY="${http_proxy}"
|
|
ENV NO_PROXY="${no_proxy}"
|
|
|
|
# Configure DNF and YUM proxies
|
|
RUN { \
|
|
echo "proxy=${http_proxy}" ; \
|
|
echo "no_proxy=${no_proxy}" ; \
|
|
} | tee -a /etc/dnf/dnf.conf /etc/yum.conf
|
|
|
|
#
|
|
# Template from templates/centos/15-upgrade.in
|
|
#
|
|
# Update package lists, and upgrade to the latest packages
|
|
#
|
|
# Failure to do this will result in GPG errors later
|
|
RUN dnf clean all \
|
|
&& dnf -y upgrade
|
|
|
|
|
|
#
|
|
# Template from templates/centos/18-create-user.in
|
|
#
|
|
# Create user 'user' and add them to 'wheel' for sudo access and set
|
|
# the passwd to 'user'
|
|
|
|
FROM xe-base-stage AS xe-user-stage
|
|
|
|
# CentOS doesn't provide openssl by default. Red Hat does.
|
|
RUN dnf install -y sudo openssl
|
|
|
|
# NOTE: Requires 'sudo' package to already be installed
|
|
RUN groupadd -r user \
|
|
&& useradd --no-log-init \
|
|
-s /bin/bash \
|
|
-r -m \
|
|
-g user \
|
|
-G wheel,video \
|
|
-p $(echo "user" | openssl passwd -stdin) user
|
|
|
|
# Set 'wheel' to NOPASSWD for all container users
|
|
RUN sed -i -e 's,%wheel.*,%wheel ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers
|
|
|
|
#
|
|
# Template from templates/centos/20-repositories-intel-com.in
|
|
#
|
|
# 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=https://osgc.jf.intel.com/internal/${PACKAGE_DISTRO}/focal-prerelease-untested/" ; \
|
|
echo "sslverify=0" ; \
|
|
echo "enabled=1" ; \
|
|
echo "gpgcheck=0" ; \
|
|
} > /etc/yum.repos.d/intel-graphics.repo
|
|
|
|
#
|
|
# Template from templates/centos/30-clean-up.in
|
|
#
|
|
# Clean dnf cache
|
|
RUN dnf clean all
|
|
|
|
#
|
|
# Template from templates/99-env.in
|
|
#
|
|
# Configure ENV variables which are set by scripts/build-dockerfile.sh
|
|
# and available in the container for use in assets/entry
|
|
|
|
ENV GPGPU_PACKAGE_REPOSITORY "https://osgc.jf.intel.com/internal"
|
|
ENV GPGPU_PACKAGE_STREAM "focal-prerelease-untested"
|
|
ENV GPGPU_PACKAGE_DISTRO "centos"
|
|
ENV GPGPU_PACKAGE_DISTRO_RELEASE "8.2"
|
|
|
|
USER user
|
|
|
|
#
|
|
# Solution begins here (from Dockerfile.solution)
|
|
#
|
|
#
|
|
# 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 (eoan) and newer
|
|
FROM xe-user-stage AS solution-build
|
|
|
|
USER root
|
|
|
|
# Install git and build tools, clone ffmpeg, and get ready to build it
|
|
RUN apt-get update \
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
&& apt-get -q -y install \
|
|
git build-essential pkg-config
|
|
|
|
# Install all required Media common packages, broken out
|
|
# from the above command to highlight which packages are
|
|
# specific to media
|
|
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 \
|
|
vainfo$VAINFO_VERSION
|
|
|
|
ENV LIBVA_DRIVER_NAME=iHD
|
|
|
|
USER user
|
|
|
|
# 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/user/ffmpeg
|
|
|
|
# Build FFmpeg
|
|
WORKDIR /home/user/ffmpeg
|
|
|
|
RUN ./configure --arch=x86_64 --disable-x86asm --enable-vaapi --enable-libmfx \
|
|
&& make -j $(nproc --all) \
|
|
&& sudo make install
|
|
|
|
FROM xe-user-stage
|
|
|
|
USER root
|
|
|
|
# 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.
|
|
#
|
|
# curl is used by assets/commands/test to obtain test content if it
|
|
# does not already exist
|
|
RUN apt-get -q update \
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
&& apt-get --no-install-recommends -q -y install \
|
|
intel-media-va-driver-non-free$INTEL_MEDIA_VA_DRIVER_NON_FREE_VERSION \
|
|
libva2$LIBVA2_VERSION \
|
|
libmfx1$LIBMFX1_VERSION \
|
|
vainfo$VAINFO_VERSION \
|
|
libpciaccess0 \
|
|
pciutils \
|
|
curl
|
|
|
|
# Copy ffmpeg and ffprobe from build container
|
|
COPY --from=solution-build /usr/local/bin/ /usr/local/bin/
|
|
|
|
RUN apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV LIBVA_DRIVER_NAME=iHD
|
|
|
|
# In order for ffmpeg to access the video input, 'user' needs to have
|
|
# access to the hardware. Not sure how to do that across different
|
|
# OS releases, so setting user to 'root' for now.
|
|
USER root
|
|
|
|
WORKDIR /home/user
|
|
|
|
|
|
#
|
|
# 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/
|
|
ENTRYPOINT [ "/assets/entry" ]
|
|
|
|
# Ensure that each Docker container self-documents the
|
|
# versions included in it
|
|
COPY SOLUTION /assets/
|
|
COPY Dockerfile /assets/Dockerfile
|