Просмотр исходного кода

Merge pull request #95 from linuxserver/release-4.2_rebase_alpine_3.8

rebase to alpine 3.8 and use buildstage type build
aptalca 8 лет назад
Родитель
Сommit
bf0911b6f5
2 измененных файлов с 172 добавлено и 86 удалено
  1. 171 86
      Dockerfile
  2. 1 0
      README.md

+ 171 - 86
Dockerfile

@@ -1,18 +1,13 @@
-FROM lsiobase/alpine:3.7
-
-# set version label
-ARG BUILD_DATE
-ARG VERSION
-LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
-LABEL maintainer="saarg"
+FROM lsiobase/alpine:3.8 as buildstage
+############## build stage ##############
 
 # package versions
 ARG ARGTABLE_VER="2.13"
 ARG TVH_VER="release/4.2"
-ARG TZ="Europe/Oslo"
 ARG XMLTV_VER="0.5.69"
 
 # environment settings
+ARG TZ="Europe/Oslo"
 ENV HOME="/config"
 
 # copy patches
@@ -20,10 +15,13 @@ COPY patches/ /tmp/patches/
 
 RUN \
  echo "**** install build packages ****" && \
- apk add --no-cache --virtual=build-dependencies \
+ apk add --no-cache \
 	autoconf \
 	automake \
+	bsd-compat-headers \
+	bzip2 \
 	cmake \
+	curl \
 	ffmpeg-dev \
 	file \
 	findutils \
@@ -31,6 +29,7 @@ RUN \
 	gcc \
 	gettext-dev \
 	git \
+	gzip \
 	libgcrypt-dev \
 	libhdhomerun-dev \
 	libressl-dev \
@@ -38,43 +37,12 @@ RUN \
 	libvpx-dev \
 	libxml2-dev \
 	libxslt-dev \
+	linux-headers \
 	make \
 	mercurial \
 	opus-dev \
 	patch \
 	pcre2-dev \
-	perl-dev \
-	pkgconf \
-	pngquant \
-	sdl-dev \
-	uriparser-dev \
-	wget \
-	x264-dev \
-	x265-dev \
-	zlib-dev && \
- apk add --no-cache --virtual=build-dependencies \
-	--repository http://nl.alpinelinux.org/alpine/edge/testing \
-	gnu-libiconv-dev && \
- echo "**** install runtime packages ****" && \
- apk add --no-cache \
-	bsd-compat-headers \
-	bzip2 \
-	curl \
-	ffmpeg \
-	ffmpeg-libs \
-	gzip \
-	libcrypto1.0 \
-	libcurl	\
-	libhdhomerun-libs \
-	libressl \
-	libssl1.0 \
-	libvpx \
-	libxml2 \
-	libxslt \
-	linux-headers \
-	opus \
-	pcre2 \
-	perl \
 	perl-archive-zip \
 	perl-boolean \
 	perl-capture-tiny \
@@ -87,6 +55,7 @@ RUN \
 	perl-datetime-timezone \
 	perl-dbd-sqlite \
 	perl-dbi \
+	perl-dev \
 	perl-digest-sha1 \
 	perl-doc \
 	perl-file-slurp \
@@ -126,28 +95,62 @@ RUN \
 	perl-xml-treepp \
 	perl-xml-twig \
 	perl-xml-writer \
+	pkgconf \
+	pngquant \
 	python \
+	sdl-dev \
 	tar \
-	uriparser \
+	uriparser-dev \
 	wget \
-	x264 \
-	x265 \
-	zlib && \
+	x264-dev \
+	x265-dev \
+	zlib-dev && \
  apk add --no-cache \
 	--repository http://nl.alpinelinux.org/alpine/edge/testing \
-	gnu-libiconv && \
+	gnu-libiconv-dev
+
+RUN \
+ echo "**** remove musl iconv.h and replace with gnu-iconv.h ****" && \
+ rm -rf /usr/include/iconv.h && \
+ cp /usr/include/gnu-libiconv/iconv.h /usr/include/iconv.h
+
+RUN \
  echo "**** install perl modules for xmltv ****" && \
  curl -L http://cpanmin.us | perl - App::cpanminus && \
- cpanm --installdeps /tmp/patches && \
- echo "**** build dvb-apps ****" && \
+ cpanm --installdeps /tmp/patches
+
+RUN \
+ echo "**** compile XMLTV ****" && \
+ curl -o \
+ /tmp/xmtltv-src.tar.bz2 -L \
+	"https://sourceforge.net/projects/xmltv/files/xmltv/${XMLTV_VER}/xmltv-${XMLTV_VER}.tar.bz2" && \
+ tar xf \
+ /tmp/xmtltv-src.tar.bz2 -C \
+	/tmp --strip-components=1 && \
+ cd "/tmp/xmltv-${XMLTV_VER}" && \
+ echo "**** Perl 5.26 fixes for XMTLV ****" && \
+ sed "s/use POSIX 'tmpnam';//" -i filter/tv_to_latex && \
+ sed "s/use POSIX 'tmpnam';//" -i filter/tv_to_text && \
+ sed "s/\(lib\/set_share_dir.pl';\)/.\/\1/" -i grab/it/tv_grab_it.PL && \
+ sed "s/\(filter\/Grep.pm';\)/.\/\1/" -i filter/tv_grep.PL && \
+ sed "s/\(lib\/XMLTV.pm.in';\)/.\/\1/" -i lib/XMLTV.pm.PL && \
+ sed "s/\(lib\/Ask\/Term.pm';\)/.\/\1/" -i Makefile.PL && \
+ PERL5LIB=`pwd` && \
+ echo -e "yes" | perl Makefile.PL PREFIX=/usr/ INSTALLDIRS=vendor && \
+ make && \
+ make test && \
+ make DESTDIR=/tmp/xmltv-build install
+
+RUN \
+ echo "**** compile dvb-apps ****" && \
  hg clone http://linuxtv.org/hg/dvb-apps /tmp/dvb-apps && \
  cd /tmp/dvb-apps && \
  make -C lib && \
- make -C lib install && \
- echo "**** remove musl iconv.h and replace with gnu-iconv.h ****" && \
- rm -rf /usr/include/iconv.h && \
- cp /usr/include/gnu-libiconv/iconv.h /usr/include/iconv.h && \
- echo "**** build tvheadend ****" && \
+ make -C lib DESTDIR=/tmp/dvbapps-build install && \
+ cp -pr /tmp/dvbapps-build/usr/* /usr/
+
+RUN \
+ echo "**** compile tvheadend ****" && \
  git clone -b ${TVH_VER} --single-branch https://github.com/tvheadend/tvheadend.git /tmp/tvheadend && \
  cd /tmp/tvheadend && \
  ./configure \
@@ -172,28 +175,10 @@ RUN \
 	--prefix=/usr \
 	--sysconfdir=/config && \
  make && \
- make install && \
- echo "**** build XMLTV ****" && \
- curl -o \
- /tmp/xmtltv-src.tar.bz2 -L \
-	"https://sourceforge.net/projects/xmltv/files/xmltv/${XMLTV_VER}/xmltv-${XMLTV_VER}.tar.bz2" && \
- tar xf \
- /tmp/xmtltv-src.tar.bz2 -C \
-	/tmp --strip-components=1 && \
- cd "/tmp/xmltv-${XMLTV_VER}" && \
- echo "**** Perl 5.26 fixes for XMTLV ****" && \
- sed "s/use POSIX 'tmpnam';//" -i filter/tv_to_latex && \
- sed "s/use POSIX 'tmpnam';//" -i filter/tv_to_text && \
- sed "s/\(lib\/set_share_dir.pl';\)/.\/\1/" -i grab/it/tv_grab_it.PL && \
- sed "s/\(filter\/Grep.pm';\)/.\/\1/" -i filter/tv_grep.PL && \
- sed "s/\(lib\/XMLTV.pm.in';\)/.\/\1/" -i lib/XMLTV.pm.PL && \
- sed "s/\(lib\/Ask\/Term.pm';\)/.\/\1/" -i Makefile.PL && \
- PERL5LIB=`pwd` && \
- echo -e "yes" | perl Makefile.PL PREFIX=/usr/ INSTALLDIRS=vendor && \
- make && \
- make test && \
- make install && \
- echo "**** build argtable2 ****" && \
+ make DESTDIR=/tmp/tvheadend-build install
+
+RUN \
+ echo "**** compile argtable2 ****" && \
  ARGTABLE_VER1="${ARGTABLE_VER//./-}" && \
  mkdir -p \
 	/tmp/argtable && \
@@ -209,8 +194,12 @@ RUN \
 	--prefix=/usr && \
  make && \
  make check && \
- make install && \
- echo "***** build comskip ****" && \
+ make DESTDIR=/tmp/argtable-build install && \
+ echo "**** copy to /usr for comskip dependency ****" && \
+ cp -pr /tmp/argtable-build/usr/* /usr/
+
+RUN \
+ echo "***** compile comskip ****" && \
  git clone git://github.com/erikkaashoek/Comskip /tmp/comskip && \
  cd /tmp/comskip && \
  ./autogen.sh && \
@@ -218,15 +207,111 @@ RUN \
 	--bindir=/usr/bin \
 	--sysconfdir=/config/comskip && \
  make && \
- make install && \
- echo "***** cleanup ****" && \
- apk del --purge \
-	build-dependencies && \
- rm -rf \
-	/config/.cpanm \
-	/tmp/*
-
-# copy local files
+ make DESTDIR=/tmp/comskip-build install
+
+############## runtime stage ##############
+FROM lsiobase/alpine:3.8
+
+# set version label
+ARG BUILD_DATE
+ARG VERSION
+LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
+LABEL maintainer="saarg"
+
+# environment settings
+ENV HOME="/config"
+
+RUN \
+ echo "**** install runtime packages ****" && \
+ apk add --no-cache \
+	bsd-compat-headers \
+	bzip2 \
+	curl \
+	ffmpeg \
+	ffmpeg-libs \
+	gzip \
+	libcrypto1.0 \
+	libcurl	\
+	libhdhomerun-libs \
+	libressl \
+	libssl1.0 \
+	libvpx \
+	libxml2 \
+	libxslt \
+	linux-headers \
+	opus \
+	pcre2 \
+	perl \
+	perl-archive-zip \
+	perl-boolean \
+	perl-capture-tiny \
+	perl-cgi \
+	perl-compress-raw-zlib \
+	perl-data-dumper \
+	perl-date-manip \
+	perl-datetime \
+	perl-datetime-format-strptime \
+	perl-datetime-timezone \
+	perl-dbd-sqlite \
+	perl-dbi \
+	perl-digest-sha1 \
+	perl-doc \
+	perl-file-slurp \
+	perl-file-temp \
+	perl-file-which \
+	perl-getopt-long \
+	perl-html-parser \
+	perl-html-tree \
+	perl-http-cookies \
+	perl-io \
+	perl-io-compress \
+	perl-io-html \
+	perl-io-socket-ssl \
+	perl-io-stringy \
+	perl-json \
+	perl-libwww \
+	perl-lingua-en-numbers-ordinate \
+	perl-lingua-preferred \
+	perl-list-moreutils \
+	perl-module-build \
+	perl-module-pluggable \
+	perl-net-ssleay \
+	perl-parse-recdescent \
+	perl-path-class \
+	perl-scalar-list-utils \
+	perl-term-progressbar \
+	perl-term-readkey \
+	perl-test-exception \
+	perl-test-requires \
+	perl-timedate \
+	perl-try-tiny \
+	perl-unicode-string \
+	perl-xml-libxml \
+	perl-xml-libxslt \
+	perl-xml-parser \
+	perl-xml-sax \
+	perl-xml-treepp \
+	perl-xml-twig \
+	perl-xml-writer \
+	python \
+	tar \
+	uriparser \
+	wget \
+	x264 \
+	x265 \
+	zlib && \
+ apk add --no-cache \
+	--repository http://nl.alpinelinux.org/alpine/edge/testing \
+	gnu-libiconv
+
+# copy local files and buildstage artifacts
+COPY --from=buildstage /tmp/argtable-build/usr/ /usr/
+COPY --from=buildstage /tmp/comskip-build/usr/ /usr/
+COPY --from=buildstage /tmp/dvbapps-build/usr/ /usr/
+COPY --from=buildstage /tmp/tvheadend-build/usr/ /usr/
+COPY --from=buildstage /tmp/xmltv-build/usr/ /usr/
+COPY --from=buildstage /usr/local/share/man/ /usr/local/share/man/
+COPY --from=buildstage /usr/local/share/perl5/ /usr/local/share/perl5/
 COPY root/ /
 
 # add picons

+ 1 - 0
README.md

@@ -160,6 +160,7 @@ You need to enable minimum advanced view level to see the picons options..
 
 ## Versions
 
++ **12.09.18:** Rebase to alpine 3.8 and use buildstage type build.
 + **21.04.18:** Add JSON::XS Perl package for grab_tv_huro.
 + **04.03.18:** Use sourceforge master rather than mirror for xmltv.
 + **22.02.18:** Add missing pngquant package.