-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile 22.04 fixes Signed-off-by: Milosz Linkiewicz <milosz.linkiewicz@intel.com>
- Loading branch information
Showing
2 changed files
with
120 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,120 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Copyright (c) 2020-2021 Intel Corporation. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
# use Ubuntu 22.04 with Intel IPP | ||
FROM intel/oneapi-basekit:2023.2-devel-ubuntu22.04 as build | ||
# use Ubuntu 22.04 with Intel IPP | ||
ARG IMAGE_CACHE_REGISTRY=docker.io | ||
ARG IMAGE_NAME=intel/oneapi-basekit:2023.2-devel-ubuntu22.04 | ||
|
||
FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS build | ||
|
||
RUN mkdir /opt/build | ||
ARG PREFIX=/opt/build | ||
ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64" | ||
ARG DL_PREFIX=/opt | ||
|
||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | ||
ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:${LD_LIBRARY_PATH}" | ||
ENV DEBIAN_FRONTEND="noninteractive" | ||
ENV TZ="Europe/Warsaw" | ||
ARG FFMPEG_COMMIT_ID="n6.0" | ||
|
||
# Update apt and install dependances | ||
WORKDIR ${DL_PREFIX}/ffmpeg | ||
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] | ||
RUN rm /etc/apt/sources.list.d/oneAPI.list && \ | ||
apt-get update && apt-get install -y \ | ||
libx265-dev \ | ||
libx264-dev \ | ||
zlib1g-dev \ | ||
nasm \ | ||
cmake | ||
|
||
COPY . ${PREFIX}/Video-Super-Resolution-Library | ||
RUN cd ${PREFIX}/Video-Super-Resolution-Library && \ | ||
./build.sh | ||
|
||
WORKDIR /opt/build | ||
RUN git config --global user.email "you@example.com" | ||
RUN git clone https://github.com/FFmpeg/FFmpeg ffmpeg | ||
WORKDIR /opt/build/ffmpeg | ||
RUN git checkout -b n6.0 n6.0 && \ | ||
cp /opt/build/Video-Super-Resolution-Library/ffmpeg/*.patch . && \ | ||
cp /opt/build/Video-Super-Resolution-Library/ffmpeg/vf_raisr*.c ./libavfilter && \ | ||
git am *.patch | ||
|
||
# Configure and build ffmpeg | ||
apt-get update --fix-missing && \ | ||
apt-get full-upgrade -y && \ | ||
apt-get install --no-install-recommends -y \ | ||
libx265-dev \ | ||
libx264-dev \ | ||
zlib1g-dev \ | ||
nasm \ | ||
cmake && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \ | ||
tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" | ||
|
||
COPY . ${DL_PREFIX}/Video-Super-Resolution-Library | ||
|
||
WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library | ||
RUN git -C "${DL_PREFIX}/ffmpeg" apply "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/"*.patch && \ | ||
cp "${DL_PREFIX}/Video-Super-Resolution-Library/ffmpeg/vf_raisr"*.c "${DL_PREFIX}/ffmpeg/libavfilter" && \ | ||
./build.sh | ||
|
||
# Configure and build ffmpeg | ||
WORKDIR ${DL_PREFIX}/ffmpeg | ||
RUN ./configure \ | ||
--enable-libipp \ | ||
--extra-cflags=-fopenmp \ | ||
--extra-ldflags=-fopenmp \ | ||
--enable-gpl \ | ||
--enable-libx264 \ | ||
--enable-libx265 \ | ||
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ | ||
--enable-cross-compile \ | ||
--prefix="${PREFIX}" && \ | ||
make clean && make -j $(nproc) && \ | ||
make install | ||
|
||
# cleanup | ||
WORKDIR /opt/build | ||
RUN \ | ||
ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippik0.so.10.8 /usr/local/lib && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsk0.so.10.8 /usr/local/lib && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn0.so.10.8 /usr/local/lib && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsl9.so.10.8 /usr/local/lib && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippse9.so.10.8 /usr/local/lib && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsy8.so.10.8 /usr/local/lib && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsn8.so.10.8 /usr/local/lib && \ | ||
cp /opt/intel/oneapi/ipp/latest/lib/intel64/libippsm7.so.10.8 /usr/local/lib && \ | ||
cp -r ${PREFIX}/bin/* /usr/local/bin/ && \ | ||
cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \ | ||
LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf && \ | ||
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \ | ||
mkdir -p /usr/local/lib/pkgconfig && \ | ||
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \ | ||
sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib/pkgconfig/"${pc##*/}"; \ | ||
done | ||
|
||
# Copy the raisr filters from the raisr library | ||
RUN mkdir /raisrfolder | ||
RUN cp -r /opt/build/Video-Super-Resolution-Library/filters* /raisrfolder | ||
|
||
FROM ubuntu:22.04 AS base | ||
|
||
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 | ||
|
||
RUN mkdir /raisrfolder | ||
COPY --from=build /usr/local /usr/local/ | ||
COPY --from=build /raisrfolder /raisrfolder | ||
|
||
RUN ln -s /usr/local/bin/ffmpeg /raisrfolder/ffmpeg | ||
|
||
WORKDIR /raisrfolder | ||
# Run ffmpeg and verify that the raisr filter is supported | ||
RUN ffmpeg -h filter=raisr | ||
--enable-libipp \ | ||
--extra-cflags=-fopenmp \ | ||
--extra-ldflags=-fopenmp \ | ||
--enable-gpl \ | ||
--enable-libx264 \ | ||
--enable-libx265 \ | ||
--extra-libs='-lraisr -lstdc++ -lippcore -lippvm -lipps -lippi -lm -lintlc -lsvml' \ | ||
--enable-cross-compile \ | ||
--prefix="${PREFIX}" && \ | ||
make clean && make -j $(nproc) && \ | ||
make install | ||
|
||
ENV LIBIPP="/opt/intel/oneapi/ipp/latest/lib/intel64" | ||
WORKDIR ${PREFIX}/usr/local/lib | ||
RUN ldd ${PREFIX}/bin/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} . && \ | ||
cp ${LIBIPP}/libippsk0.so.10.8 . && \ | ||
cp ${LIBIPP}/libippsn0.so.10.8 . && \ | ||
cp ${LIBIPP}/libippsl9.so.10.8 . && \ | ||
cp ${LIBIPP}/libippse9.so.10.8 . && \ | ||
cp ${LIBIPP}/libippsy8.so.10.8 . && \ | ||
cp ${LIBIPP}/libippsn8.so.10.8 . && \ | ||
cp ${LIBIPP}/libippsm7.so.10.8 . && \ | ||
cp ${LIBIPP}/libippik0.so.10.8 . && \ | ||
mv ${PREFIX}/bin ${PREFIX}/usr/local/ && \ | ||
LD_LIBRARY_PATH=${PREFIX}/usr/local/lib ${PREFIX}/usr/local/bin/ffmpeg -buildconf && \ | ||
rm -rf ${PREFIX}/include/ ${PREFIX}/share/ ${PREFIX}/lib/ | ||
|
||
|
||
ARG IMAGE_CACHE_REGISTRY | ||
ARG IMAGE_NAME=library/ubuntu:22.04@sha256:adbb90115a21969d2fe6fa7f9af4253e16d45f8d4c1e930182610c4731962658 | ||
|
||
FROM ${IMAGE_CACHE_REGISTRY}/${IMAGE_NAME} AS base | ||
|
||
LABEL org.opencontainers.image.authors="milosz.linkiewicz@intel.com,xiaoxia.liang@intel.com" | ||
LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library" | ||
LABEL org.opencontainers.image.title="Intel® Library for Video Super Resolution" | ||
LABEL org.opencontainers.image.description="Intel® Library for Video Super Resolution. RAISR (Rapid and Accurate Image Super Resolution) algorithm implementation by Intel® Corporation, as FFmpeg plugin. Ubuntu 22.04 Docker image." | ||
LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/master/README.md" | ||
LABEL org.opencontainers.image.version="1.0.0" | ||
LABEL org.opencontainers.image.vendor="Intel® Corporation" | ||
LABEL org.opencontainers.image.licenses="BSD 3-Clause License" | ||
|
||
ARG PREFIX=/opt/build | ||
ENV TZ=Europe/Warsaw | ||
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64 | ||
|
||
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] | ||
WORKDIR /opt/raisrfolder | ||
RUN apt-get update --fix-missing && \ | ||
apt-get full-upgrade -y && \ | ||
apt-get install --no-install-recommends -y \ | ||
sudo \ | ||
ca-certificates \ | ||
libx264-1* \ | ||
libx265-1* && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
groupadd -g 2110 vfio && \ | ||
useradd -m -s /bin/bash -G vfio -u 1002 raisr && \ | ||
usermod -aG sudo raisr | ||
|
||
COPY --chown=raisr:raisr filters_1.5x /opt/raisrfolder/filters_1.5x | ||
COPY --chown=raisr:raisr filters_2x /opt/raisrfolder/filters_2x | ||
COPY --chown=raisr:raisr --from=build ${PREFIX} / | ||
|
||
RUN ldconfig && \ | ||
ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \ | ||
/opt/raisrfolder/ffmpeg -h filter=raisr | ||
|
||
USER "raisr" | ||
HEALTHCHECK --interval=30s --timeout=5s CMD ps aux | grep "ffmpeg" || exit 1 | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
CMD ["-h", "filter=raisr"] | ||
ENTRYPOINT [ "/opt/raisrfolder/ffmpeg" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters