-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathDockerfile.worker
224 lines (200 loc) · 6.46 KB
/
Dockerfile.worker
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
FROM ubuntu:focal
# environment variables
ENV \
APP_USER=xiph \
APP_DIR=/opt/app \
LC_ALL=C.UTF-8 \
LANG=C.UTF-8 \
LANGUAGE=C.UTF-8 \
DEBIAN_FRONTEND=noninteractive
# add runtime user
RUN \
groupadd --gid 1000 ${APP_USER} && \
useradd --uid 1000 --gid ${APP_USER} --shell /bin/bash --create-home ${APP_USER}
# install common/useful packages
RUN \
ARCH=`uname -m` && \
if [ "$ARCH" = "x86_64" ]; then \
echo "deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse" >/etc/apt/sources.list && \
echo "deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse" >>/etc/apt/sources.list && \
echo "deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse" >>/etc/apt/sources.list; \
echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >>/etc/apt/sources.list; \
else \
echo "deb http://ports.ubuntu.com/ubuntu-ports/ focal main restricted universe multiverse" >/etc/apt/sources.list && \
echo "deb http://ports.ubuntu.com/ubuntu-ports focal-security main restricted universe multiverse" >>/etc/apt/sources.list && \
echo "deb http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse" >>/etc/apt/sources.list; \
fi
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
bzip2 \
ca-certificates \
check \
ctags \
curl \
file \
gettext-base \
git-core \
iproute2 \
iputils-ping \
jq \
less \
libjpeg-dev \
libogg-dev \
libpng-dev \
libtool \
locales \
netcat-openbsd \
net-tools \
openssl \
pkg-config \
procps \
psmisc \
rsync \
strace \
tcpdump \
tzdata \
unzip \
uuid \
vim \
wget \
linux-tools-$(uname -r) \
linux-tools-generic \
xz-utils && \
apt-get clean && \
rm -rf /var/lib/apt/lists
# install nasm
RUN \
ARCH=`uname -m` && \
if [ "$ARCH" = "x86_64" ]; then \
DIR=/tmp/nasm && \
NASM_URL=http://debian-archive.trafficmanager.net/debian/pool/main/n/nasm && \
NASM_VERSION=2.15.05-1 && \
NASM_DEB=nasm_${NASM_VERSION}_amd64.deb && \
NASM_SUM=c860caec653b865d5b83359452d97b11f1b3ba5b18b07cac554cf72550b3bfc9 && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -O ${NASM_URL}/${NASM_DEB} && \
echo ${NASM_SUM} ${NASM_DEB} | sha256sum --check && \
dpkg -i ${NASM_DEB} && \
rm -rf ${DIR}; \
fi
# prepare rust installation
ENV \
RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:${PATH}
# install rust
RUN \
ARCH=`uname -m` && \
RUST_VERSION=1.64.0 && \
curl -sSf --output /tmp/rustup-init https://static.rust-lang.org/rustup/archive/1.25.0/${ARCH}-unknown-linux-gnu/rustup-init && \
chmod +x /tmp/rustup-init && \
/tmp/rustup-init -y --no-modify-path --default-toolchain ${RUST_VERSION} && \
rm -vf /tmp/rustup-init
# install daalatool
ENV \
DAALATOOL_DIR=/opt/daalatool
RUN \
mkdir -p $(dirname ${DAALATOOL_DIR}) && \
git clone https://gitlab.xiph.org/xiph/daala.git ${DAALATOOL_DIR} && \
cd ${DAALATOOL_DIR} && \
./autogen.sh && \
./configure --disable-player && \
make tools -j4
# install ciede2000
ENV \
CIEDE2000_DIR=/opt/dump_ciede2000
RUN \
mkdir -p $(dirname ${CIEDE2000_DIR}) && \
git clone https://github.com/KyleSiefring/dump_ciede2000.git ${CIEDE2000_DIR} && \
cd ${CIEDE2000_DIR} && \
cargo build --release
# install hdrtools
ENV \
HDRTOOLS_DIR=/opt/hdrtools \
HDRTOOLS_VERSION=0.22
RUN \
ARCH=`uname -m` && \
mkdir -p ${HDRTOOLS_DIR} && \
curl -sSfL --output HDRTools.tar.bz2 https://gitlab.com/standards/HDRTools/-/archive/v${HDRTOOLS_VERSION}/HDRTools-v${HDRTOOLS_VERSION}.tar.bz2 && \
tar -xvf HDRTools.tar.bz2 --strip-components=1 -C ${HDRTOOLS_DIR} && \
cd ${HDRTOOLS_DIR} && \
sed -i 's/std::modff/modff/g' common/src/OutputY4M.cpp && \
sed -i 's/using ::hdrtoolslib::Y_COMP;//g' projects/HDRConvScaler/src/HDRConvScalerYUV.cpp && \
sed -i 's/\[Y_COMP\]/\[hdrtoolslib::Y_COMP\]/g' projects/HDRConvScaler/src/HDRConvScalerYUV.cpp && \
if [ "$ARCH" = "aarch64" ]; then \
# temporary patches until ARM support is upstream
sed -i 's/-msse2//g' common/Makefile projects/*/Makefile; \
sed -i 's/-mfpmath=sse//g' common/Makefile projects/*/Makefile; \
sed -i 's/#include <x86intrin.h>//g' common/src/ResizeBiCubic.cpp common/src/DistortionMetricVQM.cpp; \
sed -i 's/#include <mmintrin.h>//g' common/src/DistortionMetricVQM.cpp; \
sed -i 's/#if defined(ENABLE_SSE_OPT)/#if ENABLE_SSE_OPT/g' common/src/ResizeBiCubic.cpp; \
fi && \
make # -j is broken
# install rd_tool dependencies
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
bc \
python3-numpy \
python3-scipy \
python3-pip \
python3-setuptools \
python3-wheel \
ninja-build \
ssh \
time \
&& \
rm -vf /etc/ssh/ssh_host_*
# install dav1d and dependencies
ENV \
DAV1D_DIR=/opt/dav1d
RUN \
pip3 install meson && \
git clone https://code.videolan.org/videolan/dav1d.git ${DAV1D_DIR} && \
cd ${DAV1D_DIR} && \
mkdir build && cd build && \
meson .. --default-library static --buildtype release && \
ninja install
# install VMAF
ENV \
VMAF_DIR=/opt/vmaf \
VMAF_VERSION=v3.0.0
RUN \
mkdir -p ${VMAF_DIR} && \
curl -sSL https://github.com/Netflix/vmaf/archive/refs/tags/${VMAF_VERSION}.tar.gz | tar zxf - -C ${VMAF_DIR} --strip-components=1 && \
cd ${VMAF_DIR}/libvmaf && \
meson build --buildtype release && \
ninja -C build && \
ninja -C build install
# Intall FFmpeg 6.0 with reduced VMAF
# Custom FFmpeg 6.0 Static autobuild with GPL license
# Reduced VMAF = LIBVMAF - {CIEDE2000, MS-SSIM, CAMBI, PSNR_HVS}
RUN \
wget https://github.com/vibhoothi/FFmpeg-Builds/releases/download/latest/ffmpeg-n6.0-latest-linux64-gpl-6.0.tar.xz && \
tar -xf ffmpeg-n6.0-latest-linux64-gpl-6.0.tar.xz && \
cp ffmpeg-n6.0-latest-linux64-gpl-6.0/bin/ffmpeg /usr/local/bin/ffmpeg
# clear package manager cache
RUN \
apt-get clean && \
rm -rf /var/lib/apt/lists
# set working directory
WORKDIR /home/${APP_USER}
# environment variables
ENV \
WORK_DIR=/data/work
# create symbolic links
RUN \
mkdir /home/${APP_USER}/awcy_temp && \
chown -R ${APP_USER}:${APP_USER} /home/${APP_USER}/awcy_temp && \
ln -s /opt/daalatool /home/${APP_USER}/awcy_temp/daalatool && \
ln -s /opt/vmaf /home/${APP_USER}/awcy_temp/vmaf && \
ln -s /opt/dump_ciede2000 /home/${APP_USER}/awcy_temp/dump_ciede2000 && \
ln -s /opt/dav1d /home/${APP_USER}/awcy_temp/dav1d
# set entrypoint
ADD etc/entrypoint.worker /etc/entrypoint.worker
ENTRYPOINT [ "/etc/entrypoint.worker" ]