1
0

Updated to use multi-stage build

Signed-off-by: James P. Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
James P. Ketrenos 2019-09-24 11:25:00 -07:00
parent 7aaf9994e4
commit 54298768b5
8 changed files with 101 additions and 108 deletions

View File

@ -15,7 +15,7 @@
# Template from templates/templates/00-FROM.in # Template from templates/templates/00-FROM.in
# #
# Pull from the internal cache of images # Pull from the internal cache of images
FROM amr-registry.caas.intel.com/vtt-osgc/os/ubuntu:disco FROM amr-registry.caas.intel.com/vtt-osgc/os/ubuntu:disco AS base
# #
@ -36,11 +36,13 @@ RUN echo "Acquire::http::proxy \"http://proxy-chain.intel.com:911/\";\n" \
# #
# Install Intel CA5A cert so Intel certs are recognized # Install Intel CA5A cert so Intel certs are recognized
RUN apt-get update \ RUN apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \ ca-certificates \
wget \ wget \
unzip \ unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} \
&& mkdir -p /usr/local/share/ca-certificates \ && mkdir -p /usr/local/share/ca-certificates \
&& wget -qO tmp.zip http://certificates.intel.com/repository/certificates/IntelSHA2RootChain-Base64.zip \ && wget -qO tmp.zip http://certificates.intel.com/repository/certificates/IntelSHA2RootChain-Base64.zip \
&& unzip tmp.zip -d /usr/local/share/ca-certificates \ && unzip tmp.zip -d /usr/local/share/ca-certificates \
@ -48,6 +50,7 @@ RUN apt-get update \
&& wget -qO tmp.zip http://certificates.intel.com/repository/certificates/Intel%20Root%20Certificate%20Chain%20Base64.zip \ && wget -qO tmp.zip http://certificates.intel.com/repository/certificates/Intel%20Root%20Certificate%20Chain%20Base64.zip \
&& unzip tmp.zip -d /usr/local/share/ca-certificates \ && unzip tmp.zip -d /usr/local/share/ca-certificates \
&& rm tmp.zip \ && rm tmp.zip \
&& apt-get remove -y wget unzip \
&& update-ca-certificates --fresh && update-ca-certificates --fresh
@ -60,13 +63,8 @@ RUN apt-get update \
# #
# NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from # NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from
# trying to prompt for configuration details during install. # trying to prompt for configuration details during install.
RUN apt-get update && \ RUN apt-get -q update \
DEBIAN_FRONTEND=noninteractive apt-get install \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -q \
-y --no-install-recommends -q \
net-tools \
iputils-ping \
sudo \
wget \
locales \ locales \
software-properties-common software-properties-common
@ -75,11 +73,42 @@ 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 ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
# #
# Template from templates/templates/20-create-agama-user.in # Template from templates/templates/20-agama-packages.in
#
FROM base AS agama
# 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 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"
RUN apt-get remove -y wget
#
# Template from templates/templates/25-agama-user.in
# #
# Create user 'agama' and add them to 'sudo' for sudo access and set # Create user 'agama' and add them to 'sudo' for sudo access and set
# the passwd to 'agama' # 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 # NOTE: Requires 'sudo' package to already be installed
RUN groupadd -r agama \ RUN groupadd -r agama \
&& useradd --no-log-init \ && useradd --no-log-init \
@ -92,33 +121,6 @@ RUN groupadd -r agama \
# Set 'sudo' to NOPASSWD for all container users # Set 'sudo' to NOPASSWD for all container users
RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers RUN sed -i -e 's,%sudo.*,%sudo ALL=(ALL) NOPASSWD:ALL,g' /etc/sudoers
#
# Template 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-176 libgl1-mesa-dri=19.1.0.agama-176 \
intel-opencl=19.38.176 \
intel-media=2.10.176 libva2=2.6.0.agama-176 \
ocl-icd-libopencl1 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# #
# Solution begins here (from Dockerfile.solution) # Solution begins here (from Dockerfile.solution)
# #
@ -131,7 +133,7 @@ RUN apt-get -q update \
# image isn't polluted with build artifacts # image isn't polluted with build artifacts
# #
# NOTE: This image will only work with Ubuntu 19.04 (disco) and newer # 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 # Install git and build tools, clone ffmpeg, and get ready to build it
RUN apt-get update \ RUN apt-get update \
@ -158,16 +160,36 @@ ENV LIBVA_DRIVER_NAME=iHD
WORKDIR /home/agama/ffmpeg WORKDIR /home/agama/ffmpeg
RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \ RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \
&& make \ && make -j $(nproc --all) \
&& make install && make install
WORKDIR /home/agama 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.
RUN apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -q -y install \
intel-media=2.10.176 \
intel-gmmlib=19.3.0.176 \
libva2=2.6.0.agama-176 \
libmfx1=19.2.pre3.agama-176 \
vainfo=2.6.0.agama-176 \
libpciaccess0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ffmpeg is installed; the build and source trees are no longer needed
# RUN rm -rf /home/agama/ffmpeg
COPY assets/ /assets/ COPY assets/ /assets/
# Copy ffmpeg and ffprobe from build container
COPY --from=solution-build /usr/local/bin/ /usr/local/bin/
WORKDIR /home/agama
ENTRYPOINT [ "/assets/entry" ] ENTRYPOINT [ "/assets/entry" ]
# #
@ -178,11 +200,6 @@ ENTRYPOINT [ "/assets/entry" ]
# changes,) causing all subsequent layers to be # changes,) causing all subsequent layers to be
# regenerated. # regenerated.
# Clean up APT content that might still be around
#RUN apt-get clean autoclean \
# && apt-get autoremove -y \
# && rm -rf /var/lib/${apt,dpkg,cache,log}
# Ensure that each Docker container self-documents the # Ensure that each Docker container self-documents the
# versions included in it # versions included in it

View File

@ -7,7 +7,7 @@
# image isn't polluted with build artifacts # image isn't polluted with build artifacts
# #
# NOTE: This image will only work with Ubuntu 19.04 (disco) and newer # 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 # Install git and build tools, clone ffmpeg, and get ready to build it
RUN apt-get update \ RUN apt-get update \
@ -34,14 +34,34 @@ ENV LIBVA_DRIVER_NAME=iHD
WORKDIR /home/agama/ffmpeg WORKDIR /home/agama/ffmpeg
RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \ RUN ./configure --arch=x86_64 --disable-yasm --enable-vaapi --enable-libmfx \
&& make \ && make -j $(nproc --all) \
&& make install && make install
WORKDIR /home/agama 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.
RUN apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -q -y install \
intel-media=$INTEL_MEDIA_VERSION \
intel-gmmlib=$INTEL_GMMLIB_VERSION \
libva2=$LIBVA2_VERSION \
libmfx1=$LIBMFX1_VERSION \
vainfo=$VAINFO_VERSION \
libpciaccess0 \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# ffmpeg is installed; the build and source trees are no longer needed
# RUN rm -rf /home/agama/ffmpeg
COPY assets/ /assets/ COPY assets/ /assets/
# Copy ffmpeg and ffprobe from build container
COPY --from=solution-build /usr/local/bin/ /usr/local/bin/
WORKDIR /home/agama
ENTRYPOINT [ "/assets/entry" ] ENTRYPOINT [ "/assets/entry" ]

View File

@ -1,3 +1,3 @@
# Pull from the internal cache of images # Pull from the internal cache of images
FROM amr-registry.caas.intel.com/vtt-osgc/os/$OS_DISTRO:$OS_RELEASE FROM amr-registry.caas.intel.com/vtt-osgc/os/$OS_DISTRO:$OS_RELEASE AS base

View File

@ -1,10 +1,12 @@
# Install Intel CA5A cert so Intel certs are recognized # Install Intel CA5A cert so Intel certs are recognized
RUN apt-get update \ RUN apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \ ca-certificates \
wget \ wget \
unzip \ unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} \
&& mkdir -p /usr/local/share/ca-certificates \ && mkdir -p /usr/local/share/ca-certificates \
&& wget -qO tmp.zip http://certificates.intel.com/repository/certificates/IntelSHA2RootChain-Base64.zip \ && wget -qO tmp.zip http://certificates.intel.com/repository/certificates/IntelSHA2RootChain-Base64.zip \
&& unzip tmp.zip -d /usr/local/share/ca-certificates \ && unzip tmp.zip -d /usr/local/share/ca-certificates \
@ -12,5 +14,6 @@ RUN apt-get update \
&& wget -qO tmp.zip http://certificates.intel.com/repository/certificates/Intel%20Root%20Certificate%20Chain%20Base64.zip \ && wget -qO tmp.zip http://certificates.intel.com/repository/certificates/Intel%20Root%20Certificate%20Chain%20Base64.zip \
&& unzip tmp.zip -d /usr/local/share/ca-certificates \ && unzip tmp.zip -d /usr/local/share/ca-certificates \
&& rm tmp.zip \ && rm tmp.zip \
&& apt-get remove -y wget unzip \
&& update-ca-certificates --fresh && update-ca-certificates --fresh

View File

@ -4,13 +4,8 @@
# #
# NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from # NOTE: We use DEBIAN_FRONTEND=noninteractive to prevent krb5-user from
# trying to prompt for configuration details during install. # trying to prompt for configuration details during install.
RUN apt-get update && \ RUN apt-get -q update \
DEBIAN_FRONTEND=noninteractive apt-get install \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends -q \
-y --no-install-recommends -q \
net-tools \
iputils-ping \
sudo \
wget \
locales \ locales \
software-properties-common software-properties-common

View File

@ -1,14 +0,0 @@
# 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

View File

@ -1,23 +0,0 @@
# 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/*

View File

@ -3,11 +3,6 @@
# changes,) causing all subsequent layers to be # changes,) causing all subsequent layers to be
# regenerated. # regenerated.
# Clean up APT content that might still be around
#RUN apt-get clean autoclean \
# && apt-get autoremove -y \
# && rm -rf /var/lib/${apt,dpkg,cache,log}
# Ensure that each Docker container self-documents the # Ensure that each Docker container self-documents the
# versions included in it # versions included in it