-
Notifications
You must be signed in to change notification settings - Fork 455
/
Dockerfile-template.centos7
102 lines (90 loc) · 3.91 KB
/
Dockerfile-template.centos7
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
# ffmpeg - http://ffmpeg.org/download.html
#
# From https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
#
# https://hub.docker.com/r/jrottenberg/ffmpeg/
#
#
FROM centos:7 AS base
RUN yum -y install libgomp && \
yum clean all;
FROM base AS build
WORKDIR /tmp/workdir
ENV %%ENV%%
RUN buildDeps="autoconf \
automake \
bzip2 \
cmake3 \
diffutils \
expat-devel \
file \
gcc \
gcc-c++ \
git \
gperf \
libtool \
make \
perl \
python3 \
openssl-devel \
tar \
yasm \
which \
zlib-devel" && \
echo "${SRC}/lib" > /etc/ld.so.conf.d/libc.conf && \
yum --enablerepo=extras install -y epel-release && \
yum --enablerepo=epel install -y ${buildDeps} && \
alternatives --install /usr/bin/cmake cmake /usr/bin/cmake3 0 && \
# Install the tools required to build nasm 2.14.02 \
nasmDeps="asciidoc \
perl-Font-TTF \
perl-Sort-Versions \
xmlto" && \
yum --enablerepo=epel install -y ${nasmDeps} && \
# Compile and install nasm 2.14.02 \
DIR=/tmp/nasm && \
mkdir -p ${DIR} && \
curl -LSs https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz | \
tar xzC ${DIR} --strip-components=1 && \
pushd ${DIR} && \
./configure --host=x86_64-redhat-linux-gnu \
--build=x86_64-redhat-linux-gnu \
--prefix=/usr/local \
--exec-prefix=/usr/local \
--bindir=/usr/local/bin \
--sbindir=/usr/local/sbin \
--sysconfdir=/usr/local/etc \
--datadir=/usr/local/share \
--includedir=/usr/local/include \
--libdir=/usr/local/lib \
--libexecdir=/usr/local/libexec \
--enable-sections && \
make all && \
make install && \
make install_rdf && \
popd && rm -rf ${DIR} && \
alternatives --install /usr/bin/nasm nasm /usr/local/bin/nasm 0 && \
# Now that we have a modern nasm build and available, we can undo the last \
# yum transaction as none of those packages are required for the rest of the build \
yum history undo $(yum history info | grep 'Transaction ID' | awk -F: '{print$2}' | tr -d ' ') -y && \
yum autoremove -y
%%RUN%%
RUN \
ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib64/ && \
for lib in /usr/local/lib64/*.so.*; do ln -s "${lib##*/}" "${lib%%.so.*}".so; done && \
cp ${PREFIX}/bin/* /usr/local/bin/ && \
cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \
LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib ffmpeg -buildconf && \
cp -r ${PREFIX}/include/libav* ${PREFIX}/include/libpostproc ${PREFIX}/include/libsw* /usr/local/include && \
mkdir -p /usr/local/lib64/pkgconfig && \
for pc in ${PREFIX}/lib/pkgconfig/libav*.pc ${PREFIX}/lib/pkgconfig/libpostproc.pc ${PREFIX}/lib/pkgconfig/libsw*.pc; do \
sed "s:${PREFIX}:/usr/local:g" <"$pc" >/usr/local/lib64/pkgconfig/"${pc##*/}"; \
done
FROM base
LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
org.opencontainers.image.source=https://github.com/jrottenberg/ffmpeg
ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
ENTRYPOINT ["ffmpeg"]
COPY --from=build /usr/local/ /usr/local/
# Let's make sure the app built correctly
# Convenient to verify on https://hub.docker.com/r/jrottenberg/ffmpeg/builds/ console output