-
Notifications
You must be signed in to change notification settings - Fork 47
/
Dockerfile
353 lines (316 loc) · 10.3 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
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 \
GPG_SERVERS="hkp://keys.openpgp.org:80 hkp://p80.pool.sks-keyservers.net:80 hkp://keyserver.ubuntu.com:80"
# 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; \
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 \
cmake \
cmake-extras \
ctags \
curl \
dirmngr \
file \
gettext-base \
git-core \
gpg \
gpg-agent \
g++-aarch64-linux-gnu \
iproute2 \
iputils-ping \
jq \
less \
libicu-dev \
libjpeg-dev \
libogg-dev \
libpng-dev \
libtool \
locales \
netcat-openbsd \
net-tools \
openjdk-8-jdk-headless \
openssl \
pkg-config \
procps \
psmisc \
python2.7 \
rsync \
runit \
sqlite3 \
strace \
tcpdump \
tzdata \
unzip \
uuid \
vim \
wget \
xz-utils \
yasm \
&& \
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
# set working directory
WORKDIR ${APP_DIR}
# 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 node 18.x
RUN \
NODE_VERSION=18.6.0 && \
ARCH=`uname -m` && \
if [ "$ARCH" = "aarch64" ]; then \
ARCH='arm64'; \
else \
ARCH='x64'; \
fi && \
for key in \
4ED778F539E3634C779C87C6D7062848A1AB005C \
B9E2F5981AA6E0CD28160D9FF13993A75599653C \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
77984A986EBC2AA786BC0F66B01FBB92821C587A \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
; do \
for server in $(shuf -e ${GPG_SERVERS}) ; do \
http_proxy= gpg --keyserver "$server" --recv-keys "${key}" && break || : ; \
done ; \
done && \
echo "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" && \
curl -fSLO "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" && \
curl -fSLO "https://nodejs.org/dist/v${NODE_VERSION}/SHASUMS256.txt.asc" && \
gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc && \
grep " node-v${NODE_VERSION}-linux-${ARCH}.tar.xz\$" SHASUMS256.txt | sha256sum -c - && \
tar xJf "node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" -C /usr --strip-components=1 --no-same-owner && \
rm -vf "node-v${NODE_VERSION}-linux-${ARCH}.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt && \
ln -s /usr/bin/node /usr/bin/nodejs
# install emscripten
RUN \
ARCH=`uname -m` && \
if [ "$ARCH" = "x86_64" ]; then \
EMSDK_VERSION=1.40.1; \
EMSDK_HASH=e88a3c5bbfef172a5b947768204ef734e2fb6e04; \
else \
EMSDK_VERSION=3.1.9; \
EMSDK_HASH=e34773a0d1a2f32dd3ba90d408a30fae89aa3c5a; \
fi && \
EMSDK_VERSION=3.1.9 && \
EMSDK_HASH=e34773a0d1a2f32dd3ba90d408a30fae89aa3c5a && \
mkdir -p /opt/emsdk && \
curl -sSL https://github.com/emscripten-core/emsdk/archive/${EMSDK_HASH}.tar.gz | tar zxf - -C /opt/emsdk --strip-components=1 && \
cd /opt/emsdk && \
./emsdk update && \
./emsdk install ${EMSDK_VERSION} && \
./emsdk activate ${EMSDK_VERSION} && \
echo "hack emscript config getter (em-config)" && \
cp .emscripten /home/${APP_USER}/.emscripten && \
printf '#!/usr/bin/env python\nimport os, sys\nexecfile(os.getenv("HOME")+"/.emscripten")\nprint eval(sys.argv[1])\n' >/usr/local/bin/em-config && \
chmod a+x /usr/local/bin/em-config
# install tini
RUN \
TINI_VERSION=v0.18.0 && \
ARCH=`uname -m` && \
if [ "$ARCH" = "x86_64" ]; then \
TINI_FILE='tini'; \
else \
TINI_FILE='tini-arm64'; \
fi && \
for server in $(shuf -e ${GPG_SERVERS}) ; do \
http_proxy= gpg --keyserver "$server" --recv-keys 0527A9B7 && break || : ; \
done && \
wget -O/usr/bin/tini "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${TINI_FILE}" && \
wget -O/usr/bin/tini.asc "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/${TINI_FILE}.asc" && \
gpg --verify /usr/bin/tini.asc && \
rm -f /usr/bin/tini.asc && \
chmod a+x /usr/bin/tini
# install gosu
RUN \
GOSU_VERSION=1.11 && \
for server in $(shuf -e ${GPG_SERVERS}); do \
http_proxy= gpg --keyserver "$server" --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || : ; \
done && \
wget -O/usr/bin/gosu "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64" && \
wget -O/usr/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/${GOSU_VERSION}/gosu-amd64.asc" && \
gpg --verify /usr/bin/gosu.asc && \
rm -f /usr/bin/gosu.asc && \
chmod a+x /usr/bin/gosu
# 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 and dependencies
ENV \
RD_TOOL_DIR=/opt/rd_tool
RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
bc \
python3-boto3 \
python3-numpy \
python3-scipy \
python3-tornado \
ssh \
time \
&& \
mkdir -p ${RD_TOOL_DIR} && \
rm -vf /etc/ssh/ssh_host_* && \
curl -sSL https://github.com/xiph/rd_tool/tarball/master | tar zxf - -C ${RD_TOOL_DIR} --strip-components=1
# install meson
RUN \
apt-get install -y python3 python3-pip python3-setuptools python3-wheel ninja-build && \
pip3 install meson
# install dav1d and dependencies
ENV \
DAV1D_DIR=/opt/dav1d
RUN \
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
# clear package manager cache
RUN \
apt-get clean && \
rm -rf /var/lib/apt/lists
# add code
ADD package.json package-lock.json *.ts tsconfig.json ${APP_DIR}/
ADD www ${APP_DIR}/www
# compile typescript/nodejs code
RUN \
cd ${APP_DIR} && \
export PYTHON=python2.7 && \
alias python=python2.7 && \
rm -rf node_modules && \
npm install && \
npm run tsc
RUN \
cd ${APP_DIR}/www && \
npm install && \
npm run build
# add scripts
ADD *.m *.sh *.py ${APP_DIR}/
# AOM_CTC: Install Openpyxl
RUN \
pip3 install openpyxl xlrd==1.2.0 xlsxwriter matplotlib
# environment variables
ENV \
CONFIG_DIR=/data/conf \
CODECS_SRC_DIR=/data/src \
RUNS_DST_DIR=/data/runs \
WORK_DIR=/data/work \
MEDIAS_SRC_DIR=/data/media \
LOCAL_WORKER_ENABLED=false \
IRC_CHANNEL=none \
AWCY_API_KEY=awcy_api_key \
AWCY_SERVER_PORT=3000 \
RD_SERVER_PORT=4000
# add configuration scripts
ADD etc/* /etc/
ADD etc/service/awcy /etc/service/awcy
ADD etc/service/job-scheduler /etc/service/job-scheduler
# set entrypoint
ENTRYPOINT [ "/etc/entrypoint" ]