Skip to content
Permalink
Browse files

Fixed wkhtmltopdf integration in Alpine flavor Docker image

Building now wkhtmltopdf (used for snapshots generation) from sources,
as its package is only available on the Alpine edge branch and is not
compatible with the current Alpine (3.8) stable base image used for
YaCy.
  • Loading branch information...
luccioman committed Dec 17, 2018
1 parent 0cf9603 commit 55b059bfb5b26d9b5234da118cdfee7216b93d74
Showing with 33 additions and 3 deletions.
  1. +33 −3 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

0 comments on commit 55b059b

Please sign in to comment.
You can’t perform that action at this time.