diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 97a590f42..6ce53849e 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -7,15 +7,45 @@ FROM openjdk:8-alpine RUN java -version # Install needed packages not in base image -# (curl for sh scripts in /bin, and wkhtmltopdf,imagemagick,xvfb and ghostscript to enable PDF and image snapshot generation) -RUN apk add --no-cache curl imagemagick xvfb ghostscript && \ - apk add wkhtmltopdf --no-cache --repository https://uk.alpinelinux.org/alpine/edge/community/ +# (curl for sh scripts in /bin, and imagemagick,xvfb and ghostscript to enable PDF and image snapshot generation) +RUN apk add --no-cache curl imagemagick xvfb ghostscript + +# --- Begin of wkhtmltopdf install : compile from sources because the wkhtmltopdf Alpine package is currently only on the Alpine edge branch # set current working dir WORKDIR /tmp +# set wkhtmltopdf version once in a environment variable +ENV WKHTMLTOPDF_VERSION 0.12.5 + +# Download and extract wkhtmltopdf sources +RUN curl -fSL https://github.com/wkhtmltopdf/wkhtmltopdf/archive/${WKHTMLTOPDF_VERSION}.tar.gz -o wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz && \ + tar xzf wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz + +# set current working dir +WORKDIR wkhtmltopdf-${WKHTMLTOPDF_VERSION} + +# All in one step to reduce image size growth : +# - add packages necessary to build wkhtmltopdf from sources and then to run it +# - build wkhtmltopdf +# - create a symbolic link to the wkhtmltopdf executable at a path where YaCy is expecting it +# - remove the sources archive +# - remove the build packages +RUN apk update && \ + apk add --no-cache g++ make qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev qt5-qtxmlpatterns-dev libgcc libstdc++ musl qt5-qtbase qt5-qtbase-x11 qt5-qtsvg qt5-qtwebkit && \ + qmake-qt5 -makefile && \ + make && \ + make install && \ + rm -f /tmp/wkhtmltopdf-${WKHTMLTOPDF_VERSION}-src.tar.gz && \ + apk del g++ make qt5-qtbase-dev qt5-qtwebkit-dev qt5-qtsvg-dev qt5-qtxmlpatterns-dev + +# --- End of wkhtmltopdf install + # --- Begin of apache ant install : from binary distribution because ant is not in alpine packages +# set current working dir +WORKDIR /tmp + # set ant version once in a environment variable ENV ANT_VERSION 1.10.5