Guest User

Dockerfile

a guest
May 21st, 2018
186
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FROM ubuntu:16.04 AS base
  2.  
  3. WORKDIR /tmp/workdir
  4.  
  5. RUN apt-get -yqq update && \
  6. apt-get install -yq --no-install-recommends ca-certificates expat libgomp1 && \
  7. apt-get autoremove -y && \
  8. apt-get clean -y
  9.  
  10. FROM base as build
  11.  
  12. ARG PKG_CONFIG_PATH=/opt/ffmpeg/lib/pkgconfig
  13. ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
  14. ARG PREFIX=/opt/ffmpeg
  15. ARG MAKEFLAGS="-j2"
  16.  
  17. ENV FFMPEG_VERSION=3.4.2 \
  18. FDKAAC_VERSION=0.1.5 \
  19. LAME_VERSION=3.99.5 \
  20. LIBASS_VERSION=0.13.7 \
  21. OGG_VERSION=1.3.2 \
  22. OPENCOREAMR_VERSION=0.1.5 \
  23. OPUS_VERSION=1.2 \
  24. OPENJPEG_VERSION=2.1.2 \
  25. THEORA_VERSION=1.1.1 \
  26. VORBIS_VERSION=1.3.5 \
  27. VPX_VERSION=1.7.0 \
  28. X264_VERSION=20170226-2245-stable \
  29. X265_VERSION=2.3 \
  30. XVID_VERSION=1.3.4 \
  31. FREETYPE_VERSION=2.5.5 \
  32. FRIBIDI_VERSION=0.19.7 \
  33. FONTCONFIG_VERSION=2.12.4 \
  34. LIBVIDSTAB_VERSION=1.1.0 \
  35. KVAZAAR_VERSION=1.2.0 \
  36. AOM_VERSION=master \
  37. SRC=/usr/local
  38.  
  39. ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz"
  40. ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz"
  41. ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz"
  42. ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz"
  43. ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz"
  44. ARG FREETYPE_SHA256SUM="5d03dd76c2171a7601e9ce10551d52d4471cf92cd205948e60289251daddffa8 freetype-2.5.5.tar.gz"
  45. ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz"
  46. ARG LIBASS_SHA256SUM="8fadf294bf701300d4605e6f1d92929304187fca4b8d8a47889315526adbafd7 0.13.7.tar.gz"
  47. ARG FRIBIDI_SHA256SUM="3fc96fa9473bd31dcb5500bdf1aa78b337ba13eb8c301e7c28923fea982453a8 0.19.7.tar.gz"
  48.  
  49.  
  50. RUN buildDeps="autoconf \
  51. automake \
  52. cmake \
  53. curl \
  54. bzip2 \
  55. libexpat1-dev \
  56. g++ \
  57. gcc \
  58. git \
  59. gperf \
  60. libtool \
  61. make \
  62. nasm \
  63. perl \
  64. pkg-config \
  65. python \
  66. libssl-dev \
  67. yasm \
  68. zlib1g-dev librsvg2-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev libxcb-shape0-dev libxcb-xkb-dev" && \
  69. apt-get -yqq update && \
  70. apt-get install -yq --no-install-recommends ${buildDeps}
  71. ## opencore-amr https://sourceforge.net/projects/opencore-amr/
  72. RUN \
  73. DIR=/tmp/opencore-amr && \
  74. mkdir -p ${DIR} && \
  75. cd ${DIR} && \
  76. curl -sL https://kent.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz | \
  77. tar -zx --strip-components=1 && \
  78. ./configure --prefix="${PREFIX}" --enable-shared && \
  79. make && \
  80. make install && \
  81. rm -rf ${DIR}
  82. ## x264 http://www.videolan.org/developers/x264.html
  83. RUN \
  84. DIR=/tmp/x264 && \
  85. mkdir -p ${DIR} && \
  86. cd ${DIR} && \
  87. curl -sL https://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | \
  88. tar -jx --strip-components=1 && \
  89. ./configure --prefix="${PREFIX}" --enable-shared --enable-pic --disable-cli && \
  90. make && \
  91. make install && \
  92. rm -rf ${DIR}
  93. ### x265 http://x265.org/
  94. RUN \
  95. DIR=/tmp/x265 && \
  96. mkdir -p ${DIR} && \
  97. cd ${DIR} && \
  98. curl -sL https://download.videolan.org/pub/videolan/x265/x265_${X265_VERSION}.tar.gz | \
  99. tar -zx && \
  100. cd x265_${X265_VERSION}/build/linux && \
  101. sed -i "/-DEXTRA_LIB/ s/$/ -DCMAKE_INSTALL_PREFIX=\${PREFIX}/" multilib.sh && \
  102. sed -i "/^cmake/ s/$/ -DENABLE_CLI=OFF/" multilib.sh && \
  103. ./multilib.sh && \
  104. make -C 8bit install && \
  105. rm -rf ${DIR}
  106. ### libogg https://www.xiph.org/ogg/
  107. RUN \
  108. DIR=/tmp/ogg && \
  109. mkdir -p ${DIR} && \
  110. cd ${DIR} && \
  111. curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz && \
  112. echo ${OGG_SHA256SUM} | sha256sum --check && \
  113. tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz && \
  114. ./configure --prefix="${PREFIX}" --enable-shared && \
  115. make && \
  116. make install && \
  117. rm -rf ${DIR}
  118. ### libopus https://www.opus-codec.org/
  119. RUN \
  120. DIR=/tmp/opus && \
  121. mkdir -p ${DIR} && \
  122. cd ${DIR} && \
  123. curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz && \
  124. echo ${OPUS_SHA256SUM} | sha256sum --check && \
  125. tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz && \
  126. autoreconf -fiv && \
  127. ./configure --prefix="${PREFIX}" --enable-shared && \
  128. make && \
  129. make install && \
  130. rm -rf ${DIR}
  131. ### libvorbis https://xiph.org/vorbis/
  132. RUN \
  133. DIR=/tmp/vorbis && \
  134. mkdir -p ${DIR} && \
  135. cd ${DIR} && \
  136. curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz && \
  137. echo ${VORBIS_SHA256SUM} | sha256sum --check && \
  138. tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz && \
  139. ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \
  140. make && \
  141. make install && \
  142. rm -rf ${DIR}
  143. ### libtheora http://www.theora.org/
  144. RUN \
  145. DIR=/tmp/theora && \
  146. mkdir -p ${DIR} && \
  147. cd ${DIR} && \
  148. curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz && \
  149. echo ${THEORA_SHA256SUM} | sha256sum --check && \
  150. tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz && \
  151. ./configure --prefix="${PREFIX}" --with-ogg="${PREFIX}" --enable-shared && \
  152. make && \
  153. make install && \
  154. rm -rf ${DIR}
  155. ### libvpx https://www.webmproject.org/code/
  156. RUN \
  157. DIR=/tmp/vpx && \
  158. mkdir -p ${DIR} && \
  159. cd ${DIR} && \
  160. curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | \
  161. tar -zx --strip-components=1 && \
  162. ./configure --prefix="${PREFIX}" --enable-vp8 --enable-vp9 --enable-pic --enable-shared \
  163. --disable-debug --disable-examples --disable-docs --disable-install-bins && \
  164. make && \
  165. make install && \
  166. rm -rf ${DIR}
  167. ### libmp3lame http://lame.sourceforge.net/
  168. RUN \
  169. DIR=/tmp/lame && \
  170. mkdir -p ${DIR} && \
  171. cd ${DIR} && \
  172. curl -sL https://kent.dl.sourceforge.net/project/lame/lame/$(echo ${LAME_VERSION} | sed -e 's/[^0-9]*\([0-9]*\)[.]\([0-9]*\)[.]\([0-9]*\)\([0-9A-Za-z-]*\)/\1.\2/')/lame-${LAME_VERSION}.tar.gz | \
  173. tar -zx --strip-components=1 && \
  174. ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --enable-shared --enable-nasm --enable-pic --disable-frontend && \
  175. make && \
  176. make install && \
  177. rm -rf ${DIR}
  178. ### xvid https://www.xvid.com/
  179. RUN \
  180. DIR=/tmp/xvid && \
  181. mkdir -p ${DIR} && \
  182. cd ${DIR} && \
  183. curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz && \
  184. echo ${XVID_SHA256SUM} | sha256sum --check && \
  185. tar -zx -f xvidcore-${XVID_VERSION}.tar.gz && \
  186. cd xvidcore/build/generic && \
  187. ./configure --prefix="${PREFIX}" --bindir="${PREFIX}/bin" --datadir="${DIR}" --enable-shared --enable-shared && \
  188. make && \
  189. make install && \
  190. rm -rf ${DIR}
  191. ### fdk-aac https://github.com/mstorsjo/fdk-aac
  192. RUN \
  193. DIR=/tmp/fdk-aac && \
  194. mkdir -p ${DIR} && \
  195. cd ${DIR} && \
  196. curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | \
  197. tar -zx --strip-components=1 && \
  198. autoreconf -fiv && \
  199. ./configure --prefix="${PREFIX}" --enable-shared --datadir="${DIR}" && \
  200. make && \
  201. make install && \
  202. rm -rf ${DIR}
  203. ## openjpeg https://github.com/uclouvain/openjpeg
  204. RUN \
  205. DIR=/tmp/openjpeg && \
  206. mkdir -p ${DIR} && \
  207. cd ${DIR} && \
  208. curl -sL https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz | \
  209. tar -zx --strip-components=1 && \
  210. cmake -DBUILD_THIRDPARTY:BOOL=ON -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \
  211. make && \
  212. make install && \
  213. rm -rf ${DIR}
  214. ## freetype https://www.freetype.org/
  215. RUN \
  216. DIR=/tmp/freetype && \
  217. mkdir -p ${DIR} && \
  218. cd ${DIR} && \
  219. curl -sLO http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
  220. echo ${FREETYPE_SHA256SUM} | sha256sum --check && \
  221. tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz && \
  222. ./configure --prefix="${PREFIX}" --disable-static --enable-shared && \
  223. make && \
  224. make install && \
  225. rm -rf ${DIR}
  226. ## libvstab https://github.com/georgmartius/vid.stab
  227. RUN \
  228. DIR=/tmp/vid.stab && \
  229. mkdir -p ${DIR} && \
  230. cd ${DIR} && \
  231. curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz &&\
  232. echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check && \
  233. tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz && \
  234. cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" . && \
  235. make && \
  236. make install && \
  237. rm -rf ${DIR}
  238. ## fridibi https://www.fribidi.org/
  239. # + https://github.com/fribidi/fribidi/issues/8
  240. RUN \
  241. DIR=/tmp/fribidi && \
  242. mkdir -p ${DIR} && \
  243. cd ${DIR} && \
  244. curl -sLO https://github.com/fribidi/fribidi/archive/${FRIBIDI_VERSION}.tar.gz && \
  245. echo ${FRIBIDI_SHA256SUM} | sha256sum --check && \
  246. tar -zx --strip-components=1 -f ${FRIBIDI_VERSION}.tar.gz && \
  247. sed -i 's/^SUBDIRS =.*/SUBDIRS=gen.tab charset lib/' Makefile.am && \
  248. ./bootstrap --no-config && \
  249. ./configure -prefix="${PREFIX}" --disable-static --enable-shared && \
  250. make -j 1 && \
  251. make install && \
  252. rm -rf ${DIR}
  253. ## fontconfig https://www.freedesktop.org/wiki/Software/fontconfig/
  254. RUN \
  255. DIR=/tmp/fontconfig && \
  256. mkdir -p ${DIR} && \
  257. cd ${DIR} && \
  258. curl -sLO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${FONTCONFIG_VERSION}.tar.bz2 &&\
  259. tar -jx --strip-components=1 -f fontconfig-${FONTCONFIG_VERSION}.tar.bz2 && \
  260. ./configure -prefix="${PREFIX}" --disable-static --enable-shared && \
  261. make && \
  262. make install && \
  263. rm -rf ${DIR}
  264. ## libass https://github.com/libass/libass
  265. RUN \
  266. DIR=/tmp/libass && \
  267. mkdir -p ${DIR} && \
  268. cd ${DIR} && \
  269. curl -sLO https://github.com/libass/libass/archive/${LIBASS_VERSION}.tar.gz &&\
  270. echo ${LIBASS_SHA256SUM} | sha256sum --check && \
  271. tar -zx --strip-components=1 -f ${LIBASS_VERSION}.tar.gz && \
  272. ./autogen.sh && \
  273. ./configure -prefix="${PREFIX}" --disable-static --enable-shared && \
  274. make && \
  275. make install && \
  276. rm -rf ${DIR}
  277. ## kvazaar https://github.com/ultravideo/kvazaar
  278. RUN \
  279. DIR=/tmp/kvazaar && \
  280. mkdir -p ${DIR} && \
  281. cd ${DIR} && \
  282. curl -sLO https://github.com/ultravideo/kvazaar/archive/v${KVAZAAR_VERSION}.tar.gz &&\
  283. tar -zx --strip-components=1 -f v${KVAZAAR_VERSION}.tar.gz && \
  284. ./autogen.sh && \
  285. ./configure -prefix="${PREFIX}" --disable-static --enable-shared && \
  286. make && \
  287. make install && \
  288. rm -rf ${DIR}
  289.  
  290. RUN \
  291. dir=/tmp/aom ; \
  292. mkdir -p ${dir} ; \
  293. cd ${dir} ; \
  294. curl -sLO https://aomedia.googlesource.com/aom/+archive/${AOM_VERSION}.tar.gz ; \
  295. tar -zx -f ${AOM_VERSION}.tar.gz ; \
  296. rm -rf CMakeCache.txt CMakeFiles ; \
  297. mkdir -p ./aom_build ; \
  298. cd ./aom_build ; \
  299. cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 ..; \
  300. make ; \
  301. make install ; \
  302. rm -rf ${dir}
  303.  
  304. ## ffmpeg https://ffmpeg.org/
  305. RUN \
  306. DIR=$(mktemp -d) && cd ${DIR} && \
  307. curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
  308. tar -jx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
  309. ./configure \
  310. --disable-debug \
  311. --disable-doc \
  312. --disable-ffplay \
  313. --enable-shared \
  314. --enable-avresample \
  315. --enable-libopencore-amrnb \
  316. --enable-libopencore-amrwb \
  317. --enable-gpl \
  318. --enable-libass \
  319. --enable-libfreetype \
  320. --enable-libvidstab \
  321. --enable-libmp3lame \
  322. --enable-libopenjpeg \
  323. --enable-libopus \
  324. --enable-libtheora \
  325. --enable-libvorbis \
  326. --enable-libvpx \
  327. --enable-libx265 \
  328. --enable-libxvid \
  329. --enable-libx264 \
  330. --enable-nonfree \
  331. --enable-openssl \
  332. --enable-libfdk_aac \
  333. --enable-libkvazaar \
  334. --enable-librsvg \
  335. \
  336. --enable-postproc \
  337. --enable-small \
  338. --enable-version3 \
  339. --extra-cflags="-I${PREFIX}/include" \
  340. --extra-ldflags="-L${PREFIX}/lib" \
  341. --extra-libs=-ldl \
  342. --prefix="${PREFIX}" && \
  343. make && \
  344. make install && \
  345. make distclean && \
  346. hash -r && \
  347. cd tools && \
  348. make qt-faststart && \
  349. cp qt-faststart ${PREFIX}/bin
  350.  
  351. ## cleanup
  352. RUN \
  353. ldd ${PREFIX}/bin/ffmpeg | grep opt/ffmpeg | cut -d ' ' -f 3 | xargs -i cp {} /usr/local/lib/ && \
  354. cp ${PREFIX}/bin/* /usr/local/bin/ && \
  355. cp -r ${PREFIX}/share/ffmpeg /usr/local/share/ && \
  356. LD_LIBRARY_PATH=/usr/local/lib ffmpeg -buildconf
  357.  
  358. FROM base AS release
  359. RUN apt-get install libxcb1 librsvg2-common libxcb-shm0 libxcb-shape0 -y
  360. MAINTAINER Julien Rottenberg <julien@rottenberg.info>
  361.  
  362. #CMD ["--help"]
  363. #ENTRYPOINT ["ffmpeg"]
  364. ENV LD_LIBRARY_PATH=/usr/local/lib
  365.  
  366. COPY --from=build /usr/local /usr/local/
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×