# 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/ubuntu/00-from.in # # Pull from ubuntu on Docker Hub FROM ubuntu:focal AS xe-base-stage # # 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 # 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 -q update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -q \ 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 from templates/ubuntu/18-create-user.in # # Create user 'user' and add them to 'sudo' for sudo access and set # the passwd to 'user' FROM xe-base-stage AS xe-user-stage RUN apt-get -q update \ && DEBIAN_FRONTEND=noninteractive \ && apt-get install --no-install-recommends -y \ sudo ARG USER_UID=1000 ARG USER_GID=1000 RUN echo "Creating 'user': $USER_UID:$USER_GID" # NOTE: Requires 'sudo' package to already be installed RUN groupadd -g $USER_GID user \ && useradd --no-log-init \ -s /bin/bash \ -m \ -u $USER_UID \ -g user \ -G sudo,video \ -p $(echo "user" | openssl passwd -stdin) user # Set 'sudo' to NOPASSWD for all container users RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers RUN echo "Defaults !env_reset" >> /etc/sudoers RUN apt-get clean \ && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} # # Template from templates/ubuntu/20-repositories-intel-com.in # # Update and install wget and 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 # Fetch and install the signing key for https://repositories.intel.com/graphics # RUN wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | apt-key add - RUN apt-add-repository \ 'deb [arch=amd64] https://repositories.intel.com/graphics/ubuntu focal main' # Cleanup #RUN apt-get remove -y wget \ # && apt-get clean \ # && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} # # 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://repositories.intel.com/graphics" ENV GPGPU_PACKAGE_STREAM "focal" ENV GPGPU_PACKAGE_DISTRO "ubuntu" ENV GPGPU_PACKAGE_DISTRO_RELEASE "focal" 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 \ libmfx-dev \ libmfx1 \ vainfo RUN sed -i -e 's,^# deb-src,deb-src,g' /etc/apt/sources.list RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive \ && apt-get build-dep -y \ ffmpeg 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 n5.0.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 --enable-nonfree \ --arch=amd64 --enable-gpl --disable-stripping --enable-swresample --disable-filter=resample --enable-gnutls \ --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 \ --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack \ --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg \ --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora \ --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 \ --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl \ --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 \ && make -j $(nproc --all) \ && sudo make install # --enable-shared \ 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 \ libva2 \ libmfx1 \ vainfo \ libpciaccess0 \ pciutils \ curl \ ffmpeg # 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