Skip to content

Commit

Permalink
Fixed wkhtmltopdf integration in Alpine flavor Docker image
Browse files Browse the repository at this point in the history
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 55b059b
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions docker/Dockerfile.alpine
Expand Up @@ -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

Expand Down

0 comments on commit 55b059b

Please sign in to comment.