-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
78 lines (70 loc) · 2.57 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
# syntax=docker/dockerfile:1
# bump: aom /AOM_VERSION=([\d.]+)/ git:https://aomedia.googlesource.com/aom|*
# bump: aom after ./hashupdate Dockerfile AOM $LATEST
# bump: aom after COMMIT=$(git ls-remote https://aomedia.googlesource.com/aom v$LATEST^{} | awk '{print $1}') && sed -i -E "s/^ARG AOM_COMMIT=.*/ARG AOM_COMMIT=$COMMIT/" Dockerfile
# bump: aom link "CHANGELOG" https://aomedia.googlesource.com/aom/+/refs/tags/v$LATEST/CHANGELOG
ARG AOM_VERSION=3.6.0
ARG AOM_URL="https://aomedia.googlesource.com/aom"
ARG AOM_COMMIT=3c65175b1972da4a1992c1dae2365b48d13f9a8d
# Must be specified
ARG ALPINE_VERSION
# Can be specified as anything@sha256:<hash>
ARG LIBVMAF_VERSION=main
FROM alpine:${ALPINE_VERSION} AS base
FROM ghcr.io/ffbuilds/static-libvmaf-alpine_${ALPINE_VERSION}:${LIBVMAF_VERSION} AS vmaf
FROM base AS download
ARG AOM_VERSION
ARG AOM_URL
ARG AOM_COMMIT
WORKDIR /tmp
RUN \
apk add --no-cache --virtual download \
git && \
git clone --depth 1 --branch v$AOM_VERSION "$AOM_URL" && \
cd aom && test $(git rev-parse HEAD) = $AOM_COMMIT && \
apk del download
FROM base AS build
COPY --from=download /tmp/aom/ /tmp/aom/
COPY --from=vmaf /usr/local/lib/pkgconfig/libvmaf.pc /usr/local/lib/pkgconfig/libvmaf.pc
COPY --from=vmaf /usr/local/lib/libvmaf.a /usr/local/lib/libvmaf.a
COPY --from=vmaf /usr/local/include/libvmaf/ /usr/local/include/libvmaf/
ARG TARGETPLATFORM
WORKDIR /tmp/aom/build_tmp
RUN \
case ${TARGETPLATFORM} in \
linux/arm/v*) \
# Fails on https://gist.github.com/binoculars/4e743eb4c822f336d0b3e0b056caafaf
# Fake it 'til we make it
touch /usr/local/lib/pkgconfig/aom.pc && \
touch /usr/local/lib/libaom.a && \
mkdir -p /usr/local/include/aom/ && \
exit 0 \
;; \
esac && \
apk add --no-cache --virtual build \
build-base cmake yasm nasm perl pkgconf && \
cmake \
-G"Unix Makefiles" \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DENABLE_EXAMPLES=NO \
-DENABLE_DOCS=NO \
-DENABLE_TESTS=NO \
-DENABLE_TOOLS=NO \
-DCONFIG_TUNE_VMAF=1 \
-DENABLE_NASM=ON \
-DCMAKE_INSTALL_LIBDIR=lib \
.. && \
make -j$(nproc) install && \
# Sanity tests
pkg-config --exists --modversion --path aom && \
ar -t /usr/local/lib/libaom.a && \
readelf -h /usr/local/lib/libaom.a && \
# Cleanup
apk del build
FROM scratch
ARG AOM_VERSION
COPY --from=build /usr/local/lib/pkgconfig/aom.pc /usr/local/lib/pkgconfig/aom.pc
COPY --from=build /usr/local/lib/libaom.a /usr/local/lib/libaom.a
COPY --from=build /usr/local/include/aom/ /usr/local/include/aom/