forked from intel/media-delivery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
519 lines (463 loc) · 15.8 KB
/
Dockerfile
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# Copyright (c) 2020 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This file is automatically generated from .m4 template.
# To update, modify the template and regenerate.
ARG IMAGE=ubuntu:20.04
FROM $IMAGE AS base
FROM base as content
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates wget && \
rm -rf /var/lib/apt/lists/*
# Refer to usage.txt for the content copyright notice(s)
RUN mkdir -p /downloads && cd /downloads && \
wget --progress=bar:force https://repositories.intel.com/media/usage.txt && \
wget --progress=bar:force https://repositories.intel.com/media/WAR_TRAILER_HiQ_10_withAudio.mp4
FROM base as build
RUN mkdir -p /opt/build && mkdir -p /opt/dist
ENV PKG_CONFIG_PATH=/opt/intel/samples/lib/pkgconfig
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
cmake && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
automake \
ca-certificates \
gcc \
libdrm-dev \
libtool \
make \
pkg-config \
wget \
libx11-dev \
libxext-dev \
libxfixes-dev \
&& \
rm -rf /var/lib/apt/lists/*
# build libva2
ARG LIBVA2_REPO=https://github.com/intel/libva/archive/2.15.0.tar.gz
RUN cd /opt/build && \
wget -O - ${LIBVA2_REPO} | tar xz
RUN cd /opt/build/libva-2.15.0 && \
./autogen.sh --prefix=/opt/intel/samples --libdir=/opt/intel/samples/lib && \
make -j$(nproc) && \
make install DESTDIR=/opt/dist && \
make install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
g++ \
make \
wget && \
rm -rf /var/lib/apt/lists/*
# build gmmlib
ARG GMMLIB_REPO=https://github.com/intel/gmmlib/archive/intel-gmmlib-22.1.7.tar.gz
RUN cd /opt/build && \
wget -O - ${GMMLIB_REPO} | tar xz
RUN cd /opt/build/gmmlib-intel-gmmlib-22.1.7 && mkdir build && cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/intel/samples \
-DCMAKE_INSTALL_LIBDIR=/opt/intel/samples/lib \
.. && \
make -j$(nproc) && \
make install DESTDIR=/opt/dist && \
make install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
g++ \
make \
patch \
pkg-config \
wget && \
rm -rf /var/lib/apt/lists/*
# build media driver
ARG MEDIA_DRIVER_REPO=https://github.com/intel/media-driver/archive/intel-media-22.5.2.tar.gz
RUN cd /opt/build && \
wget -O - ${MEDIA_DRIVER_REPO} | tar xz
COPY patches/media-driver /opt/build/media-driver-intel-media-22.5.2
RUN cd /opt/build/media-driver-intel-media-22.5.2 && { set -e; \
for patch_file in $(find -iname "*.patch" | sort -n); do \
echo "Applying: ${patch_file}"; \
patch -p1 < ${patch_file}; \
done; }
RUN cd /opt/build/media-driver-intel-media-22.5.2 && mkdir build && cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/intel/samples \
-DCMAKE_INSTALL_LIBDIR=/opt/intel/samples/lib \
-DENABLE_PRODUCTION_KMD=OFF \
.. && \
make -j$(nproc) && \
make install DESTDIR=/opt/dist && \
make install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
automake \
ca-certificates \
gcc \
g++ \
libdrm-dev \
libtool \
make \
pkg-config \
wget && \
rm -rf /var/lib/apt/lists/*
# build libva2-utils
ARG LIBVA2_UTILS_REPO=https://github.com/intel/libva-utils/archive/2.15.0.tar.gz
RUN cd /opt/build && wget -O - ${LIBVA2_UTILS_REPO} | tar xz
RUN cd /opt/build/libva-utils-2.15.0 && \
./autogen.sh --prefix=/opt/intel/samples --libdir=/opt/intel/samples/lib && \
make -j$(nproc) && \
make install DESTDIR=/opt/dist && \
make install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
automake \
ca-certificates \
gcc \
g++ \
make \
pkg-config \
wget \
cmake \
dh-autoreconf && \
rm -rf /var/lib/apt/lists/*
ARG ONEVPL_REPO=https://github.com/oneapi-src/oneVPL/archive/v2022.2.0.tar.gz
RUN cd /opt/build && \
wget -O - ${ONEVPL_REPO} | tar xz
COPY patches/libvpl2 /opt/build/oneVPL-2022.2.0
RUN cd /opt/build/oneVPL-2022.2.0 && { set -e; \
for patch_file in $(find -iname "*.patch" | sort -n); do \
echo "Applying: ${patch_file}"; \
patch -p1 < ${patch_file}; \
done; }
# build oneVPL
RUN cd /opt/build/oneVPL-2022.2.0 && \
mkdir build && cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/intel/samples \
-DCMAKE_INSTALL_LIBDIR=/opt/intel/samples/lib \
.. && \
make -j$(nproc) && \
make install DESTDIR=/opt/dist && \
make install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
g++ \
wget \
pkg-config \
cmake \
make && \
rm -rf /var/lib/apt/lists/*
ARG ONEVPLGPU_REPO=https://github.com/oneapi-src/oneVPL-intel-gpu/archive/intel-onevpl-22.5.2.tar.gz
RUN cd /opt/build && \
wget -O - ${ONEVPLGPU_REPO} | tar xz
# build oneVPL gpu
RUN cd /opt/build/oneVPL-intel-gpu-intel-onevpl-22.5.2 && \
mkdir -p _build && cd _build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/intel/samples \
-DCMAKE_INSTALL_LIBDIR=/opt/intel/samples/lib \
-DMFX_ENABLE_AENC=ON \
.. && \
make -j$(nproc) && \
make install DESTDIR=/opt/dist && \
make install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
g++ \
make \
pkg-config \
wget && \
rm -rf /var/lib/apt/lists/*
# build media sdk
ARG MSDK_REPO=https://github.com/Intel-Media-SDK/MediaSDK/archive/intel-mediasdk-22.5.2.tar.gz
RUN cd /opt/build && \
wget -O - ${MSDK_REPO} | tar xz
RUN cd /opt/build/MediaSDK-intel-mediasdk-22.5.2 && \
mkdir -p build && cd build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/opt/intel/samples \
-DCMAKE_INSTALL_LIBDIR=/opt/intel/samples/lib \
-DBUILD_SAMPLES=OFF \
-DBUILD_TUTORIALS=OFF \
.. && \
make -j$(nproc) && \
make install DESTDIR=/opt/dist && \
make install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
g++ \
git \
make \
meson \
nasm \
patch \
pkg-config \
cython3 \
python3 \
python3-dev \
python3-numpy \
python3-setuptools \
python3-wheel && \
rm -rf /var/lib/apt/lists/*
# As of now we need 2 things from VMAF: libvmaf library against which we will link
# ffmpeg and model *.pkl files to be able to calculate VMAF.
RUN git clone --depth 1 --branch v2.2.1 https://github.com/Netflix/vmaf.git /opt/build/vmaf
COPY patches/vmaf /opt/build/vmaf
RUN cd /opt/build/vmaf && { set -e; \
for patch_file in $(find -iname "*.patch" | sort -n); do \
echo "Applying: ${patch_file}"; \
patch -p1 < ${patch_file}; \
done; }
RUN cd /opt/build/vmaf/libvmaf \
&& meson build \
--buildtype=release \
--prefix=/opt/intel/samples \
--libdir=/opt/intel/samples/lib \
&& ninja -j $(nproc --all) -C build \
&& DESTDIR=/opt/dist ninja -C build install \
&& ninja -C build install
RUN cd /opt/build/vmaf/python \
&& python3 setup.py build \
&& python3 setup.py bdist_wheel --dist-dir=/opt/wheel
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
tar \
g++ \
wget \
pkg-config \
nasm \
meson && \
rm -rf /var/lib/apt/lists/*
# build dav1d
ARG DAV1D_REPO=https://code.videolan.org/videolan/dav1d/-/archive/0.9.2/dav1d-0.9.2.tar.gz
RUN cd /opt/build && \
wget -O - ${DAV1D_REPO} | tar xz
RUN cd /opt/build/dav1d-0.9.2 && \
meson build --prefix=/opt/intel/samples --libdir /opt/intel/samples/lib --buildtype=plain && \
cd build && \
ninja install && \
DESTDIR=/opt/dist ninja install
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
g++ \
git \
libx264-dev \
libx265-dev \
make \
patch \
pkg-config \
yasm && \
rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/ffmpeg/ffmpeg /opt/build/ffmpeg && \
cd /opt/build/ffmpeg && \
git checkout f6a36c7
COPY patches/ffmpeg /opt/build/ffmpeg
RUN cd /opt/build/ffmpeg && { set -e; \
for patch_file in $(find -iname "*.patch" | sort -n); do \
echo "Applying: ${patch_file}"; \
patch -p1 < ${patch_file}; \
done; }
RUN cd /opt/build/ffmpeg && \
./configure \
--prefix=/opt/intel/samples \
--libdir=/opt/intel/samples/lib \
--disable-static \
--disable-doc \
--enable-shared \
--enable-vaapi \
--enable-libvpl \
--enable-gpl \
--enable-libx264 \
--enable-libx265 \
--enable-version3 \
--enable-libvmaf \
--enable-libdav1d \
&& make -j $(nproc --all) \
&& make install DESTDIR=/opt/dist \
&& make install
# Cleaning up...
RUN rm -rf /opt/build/ffmpeg
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
asciidoc-base \
docbook-utils \
docbook-xsl \
make \
xmlto \
xsltproc && \
rm -rf /var/lib/apt/lists/*
# Building some manual pages for the sample
COPY doc/man /opt/build/manuals
RUN cd /opt/build/manuals && make -j $(nproc --all) && \
DESTDIR=/opt/dist make prefix=/opt/intel/samples install
RUN rm -rf /opt/build/manuals
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
bison \
flex \
git \
libcairo-dev \
libdrm-dev \
libdw-dev \
libkmod-dev \
libpciaccess-dev \
libpixman-1-dev \
libprocps-dev \
libudev-dev \
meson \
pkg-config && \
rm -rf /var/lib/apt/lists/*
ARG IGT_REPO=https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
RUN git clone $IGT_REPO /opt/build/igt
RUN cd /opt/build/igt \
&& git checkout 1869d560c550ac273f495076ead46f8a337fc20b \
&& meson build \
--buildtype=release \
--prefix=/opt/intel/samples \
--libdir=/opt/intel/samples/lib \
-Ddocs=disabled -Dman=disabled -Dlibdrm_drivers=intel \
-Doverlay=disabled -Drunner=disabled -Dtests=disabled \
&& ninja -j $(nproc --all) -C build \
&& DESTDIR=/opt/dist ninja -C build install \
&& ninja -C build install
# Ok, here goes the final image end-user will actually see
FROM base
LABEL vendor="Intel Corporation"
COPY --from=content /downloads /opt/data/embedded
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libdrm2 \
libx11-6 \
libxext6 \
libxfixes3 \
python3 \
python3-pip \
libx264-155 \
libx265-179 \
libxcb-shm0 \
less \
man-db \
libglib2.0-0 \
libnginx-mod-http-lua \
libnginx-mod-rtmp \
linux-tools-generic \
nginx \
pciutils \
python3-matplotlib \
python3-numpy \
socat \
tmux \
curl \
sudo \
vim \
wget && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /opt/dist /
RUN echo "/opt/intel/samples/lib" >> /etc/ld.so.conf.d/all-libs.conf && ldconfig
# Custom component installation rules, if any...
COPY --from=build /opt/wheel /opt/wheel
RUN python3 -m pip install --no-deps --prefix=/opt/intel/samples /opt/wheel/* && rm -rf /opt/wheel
# Restoring man which is excluded from the minimal ubuntu image
RUN rm -f /usr/bin/man && dpkg-divert --quiet --remove --rename /usr/bin/man
RUN setcap cap_sys_admin+ep $(find /opt -name intel_gpu_top)
# perf is tight to particular kernel version per old WA which will never
# be fixed, we just need to use some version
RUN ln -fs $(find /usr/lib/linux-tools -name perf) /usr/bin/perf;
# Granting CAP_SYS_ADMIN to the Linux perf to be able to get global perf
# events (specifically: i915 events). Mind that this will work if container
# is started with:
# --cap-add SYS_ADMIN --security-opt="no-new-privileges:false"
# If it was started with
# --cap-add SYS_ADMIN --security-opt="no-new-privileges:true"
# then you need to adjust /proc/sys/kernel/perf_event_paranoid on a host to have
# value <=0
RUN setcap cap_sys_admin+ep $(readlink -f $(which perf))
#RUN setcap cap_sys_admin+ep $(readlink -f $(which intel_gpu_top))
# Installing entrypoint helper scripts
COPY assets/demo-alive /usr/bin/
COPY assets/demo-bash /usr/bin/
COPY assets/hello-bash /usr/bin/
# Create default container user <user>
RUN groupadd -r user && useradd -lrm -s /bin/bash -g user user
RUN usermod -aG sudo user && \
sed -i -e "s/%sudo.*/%sudo ALL=(ALL) NOPASSWD:ALL/g" /etc/sudoers
# Creating locations sample will need and giving permissions
# to the default user
RUN mkdir -p /opt/data/content
RUN mkdir -p /opt/data/artifacts && chown user /opt/data/artifacts
RUN mkdir -p /opt/data/duplicates && chown user /opt/data/duplicates
# The following are locations used by nginx to produce HLS streams,
# dump logs, etc.
RUN mkdir -p /var/www/hls && chown user /var/www/hls
RUN chown -R user /var/log/nginx
RUN chown -R user /var/lib/nginx
# Setting up sample
ARG SAMPLE=cdn
COPY . /tmp/src
RUN cd /tmp/src/samples/$SAMPLE && ./setup.sh /opt/intel/samples && rm -rf /tmp/src
# Setting up environment common for all samples
# Declaring volumes which you might wish to optionally mount
# * /opt/data/content is where you can put your own content to access from inside
# the sample demos
# * /opt/data/artifacts is a location where sample will produce some output
# artifacts like generated or captured stream and logs. You can wish to twick
# this location to get artifacts on your host system
# * /var/www/hls is a location where sample demos will generate HLS streams. You
# might wish to twick this location to get access to these streams. Mind that
# this is server side raw HLS stream. If you run some demo client to capture
# streaming video - look in the /opt/data/artifacts
VOLUME /opt/data/content
VOLUME /opt/data/artifacts
VOLUME /var/www/hls
# Check running container healthy status with:
# docker inspect --format="{{json .State.Health}}" <container-id>
HEALTHCHECK CMD /usr/bin/demo-alive
# hello-bash is a default command which will be executed by demo-bash if
# user did not provide any arguments starting the container. Basically hello-bash
# will print welcome message and enter regular bash with correct environment.
CMD ["/usr/bin/hello-bash"]
# demo-bash will execute whatever command is provided by the user making
# sure that environment settings are correct.
ENTRYPOINT ["/usr/bin/demo-bash"]
# ... end of custom installation rules
# Custom component environment variables, if any...
ENV ONEVPL_SEARCH_PATH=/opt/intel/samples/lib/
# ... end of custom environment variables
USER user
WORKDIR /home/user