-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
61 lines (55 loc) · 2.12 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
# syntax=docker/dockerfile:1
# bump: libvpx /VPX_VERSION=([\d.]+)/ https://github.com/webmproject/libvpx.git|*
# bump: libvpx after ./hashupdate Dockerfile VPX $LATEST
# bump: libvpx link "CHANGELOG" https://github.com/webmproject/libvpx/blob/master/CHANGELOG
# bump: libvpx link "Source diff $CURRENT..$LATEST" https://github.com/webmproject/libvpx/compare/v$CURRENT..v$LATEST
ARG VPX_VERSION=1.12.0
ARG VPX_URL="https://github.com/webmproject/libvpx/archive/v$VPX_VERSION.tar.gz"
ARG VPX_SHA256=f1acc15d0fd0cb431f4bf6eac32d5e932e40ea1186fe78e074254d6d003957bb
# Must be specified
ARG ALPINE_VERSION
FROM alpine:${ALPINE_VERSION} AS base
FROM base AS download
ARG VPX_URL
ARG VPX_SHA256
ARG WGET_OPTS="--retry-on-host-error --retry-on-http-error=429,500,502,503 -nv"
WORKDIR /tmp
RUN \
apk add --no-cache --virtual download \
coreutils wget tar && \
wget $WGET_OPTS -O libvpx.tar.gz "$VPX_URL" && \
echo "$VPX_SHA256 libvpx.tar.gz" | sha256sum --status -c - && \
mkdir libvpx && \
tar xf libvpx.tar.gz -C libvpx --strip-components=1 && \
rm libvpx.tar.gz && \
apk del download
FROM base AS build
COPY --from=download /tmp/libvpx/ /tmp/libvpx/
ARG TARGETPLATFORM
WORKDIR /tmp/libvpx
RUN \
case ${TARGETPLATFORM} in \
linux/arm/v*) \
# Fake it 'til we make it
mkdir -p /usr/local/lib/pkgconfig/ && \
touch /usr/local/lib/pkgconfig/vpx.pc && \
touch /usr/local/lib/libvpx.a && \
mkdir -p /usr/local/include/vpx/ && \
exit 0 \
;; \
esac && \
apk add --no-cache --virtual build \
build-base diffutils perl nasm yasm pkgconf && \
./configure --enable-static --enable-vp9-highbitdepth --disable-shared --disable-unit-tests --disable-examples && \
make -j$(nproc) install && \
# Sanity tests
pkg-config --exists --modversion --path vpx && \
ar -t /usr/local/lib/libvpx.a && \
readelf -h /usr/local/lib/libvpx.a && \
# Cleanup
apk del build
FROM scratch
ARG VPX_VERSION
COPY --from=build /usr/local/lib/pkgconfig/vpx.pc /usr/local/lib/pkgconfig/vpx.pc
COPY --from=build /usr/local/lib/libvpx.a /usr/local/lib/libvpx.a
COPY --from=build /usr/local/include/vpx/ /usr/local/include/vpx/