forked from OpenVisualCloud/Video-Super-Resolution-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.centos9
More file actions
144 lines (123 loc) · 5.49 KB
/
Dockerfile.centos9
File metadata and controls
144 lines (123 loc) · 5.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# syntax=docker/dockerfile:1
#
# Copyright (c) 2020-2021 Intel Corporation.
# SPDX-License-Identifier: BSD-3-Clause
#
FROM quay.io/centos/centos:stream9 AS build
ARG DL_PREFIX=/opt
ARG PREFIX=/opt/build
ARG LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64"
ARG FFMPEG_COMMIT_ID="n7.1"
ENV TZ="Europe/Warsaw"
ARG ONEAPI_LINK="https://registrationcenter-download.intel.com/akdlm/IRC_NAS/046b1402-c5b8-4753-9500-33ffb665123f/l_ipp_oneapi_p_2021.10.1.16_offline.sh"
ARG NASM_RPM_LINK="https://rpmfind.net/linux/centos-stream/9-stream/CRB/x86_64/os/Packages/nasm-2.15.03-7.el9.x86_64.rpm"
COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"]
WORKDIR "${PREFIX}"
RUN yum install -y \
bash \
git \
make \
cmake \
glibc \
bzip2 \
zlib-devel \
texinfo \
intel-oneapi-ipp-devel \
gcc-toolset-12-gcc-c++ \
gcc-toolset-12-gcc \
gcc-toolset-12-binutils && \
curl -Lf "${NASM_RPM_LINK}" -o "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \
yum localinstall -y "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \
rm -f "${PREFIX}/nasm-2.15.03-7.el9.x86_64.rpm" && \
yum group list && \
yum group install "Development Tools" -y && \
yum clean all && \
rm -rf /var/cache/yum
WORKDIR ${DL_PREFIX}/libx264
RUN git clone https://github.com/mirror/x264 -b stable --depth 1 . && \
./configure --prefix="${PREFIX}" --libdir="${PREFIX}/lib" --enable-shared && \
make -j"$(nproc)" && \
make install
WORKDIR ${DL_PREFIX}/libx265/build/linux
RUN curl -Lf https://github.com/videolan/x265/archive/3.4.tar.gz | \
tar -zx --strip-components=1 -C "${DL_PREFIX}/libx265/" && \
cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DHIGH_BIT_DEPTH=ON ../../source && \
make -j"$(nproc)" && \
make install
ENV IPPROOT="/opt/intel/oneapi/ipp/latest"
ENV IP_PPREFIX="/opt/intel/oneapi/ipp/latest"
ENV PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/build/lib/pkgconfig"
ENV CPATH="${IPPROOT}/include:${IPPROOT}/include/ipp"
ENV IPP_TARGET_ARCH="intel64"
ENV LD_LIBRARY_PATH="/opt/build/lib:/opt/build/lib64:/usr/local/lib:/usr/local/lib64:${IPPROOT}/lib/intel64"
ENV LIBRARY_PATH="${IPPROOT}/lib/intel64"
WORKDIR ${DL_PREFIX}/Video-Super-Resolution-Library
COPY . ${DL_PREFIX}/Video-Super-Resolution-Library
RUN mkdir -p "${DL_PREFIX}/ffmpeg" && \
curl -Lf https://github.com/ffmpeg/ffmpeg/archive/${FFMPEG_COMMIT_ID}.tar.gz | \
tar -zx --strip-components=1 -C "${DL_PREFIX}/ffmpeg" && \
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
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' \
--enable-cross-compile \
--prefix="${PREFIX}" && \
make clean && \
make -j"$(nproc)" && \
make install && \
rm -rf "${DL_PREFIX}/libx265" "${DL_PREFIX}/libx264"
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 {} . && \
mv "${PREFIX}/bin" "${PREFIX}/usr/local/" && \
rm -rf "${PREFIX:?}/share" "${PREFIX:?}/include" "${PREFIX:?}/lib" && \
LD_LIBRARY_PATH="${PREFIX}/usr/local/lib:${LIBIPP}" "${PREFIX}/usr/local/bin/ffmpeg" -buildconf
FROM quay.io/centos/centos:stream9 AS base
LABEL org.opencontainers.image.authors="milosz.linkiewicz@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. Centos::stream9 image."
LABEL org.opencontainers.image.documentation="https://github.com/OpenVisualCloud/Video-Super-Resolution-Library/blob/main/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 IPP_TARGET_ARCH="intel64"
ENV IPPROOT="/opt/intel/oneapi/redist"
ENV LIBIPP="${IPPROOT}/lib"
ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64:${LIBIPP}"
COPY docker/Xeon/yum/oneAPI.repo /etc/yum.repos.d
SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"]
WORKDIR /opt/raisrfolder
RUN yum install -y \
sudo \
bash \
make \
intel-oneapi-runtime-ipp && \
yum clean all && \
rm -rf /var/cache/yum && \
groupadd -g 2110 vfio && \
useradd -m -s /bin/bash -G vfio -u 1002 raisr && \
usermod -aG wheel 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 ln -s /usr/local/bin/ffmpeg /opt/raisrfolder/ffmpeg && \
ldconfig && \
/usr/local/bin/ffmpeg -buildconf && \
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" ]