diff --git a/doc/docker/Dockerfile-varnish b/doc/docker/Dockerfile-varnish index b40422cc1c..7550088076 100644 --- a/doc/docker/Dockerfile-varnish +++ b/doc/docker/Dockerfile-varnish @@ -1,19 +1,53 @@ FROM debian:stretch-slim -ENV DEBIAN_FRONTEND noninteractive +ENV VARNISH_MALLOC_SIZE="256M" \ + DEBIAN_FRONTEND=noninteractive -# Use packages from Varnish to get Varnsih 5.1, 5.0 packages with debian:stretch gives segmentation faults -RUN apt-get update -q -y && \ - apt-get install -q -y --no-install-recommends ca-certificates curl && \ - curl -s https://packagecloud.io/install/repositories/varnishcache/varnish5/script.deb.sh | bash && \ - apt-get install -q -y --allow-unauthenticated --no-install-recommends varnish && \ - rm -rf /var/lib/apt/lists/* +ARG PACKAGECLOUD_URL=https://packagecloud.io/install/repositories/varnishcache/varnish5/script.deb.sh +ARG VARNISH_MODULES_VERSION=0.12.1 + +# Use offical packages from Varnish and build with varnish-modules mainly for xkey +# see: https://github.com/varnish/varnish-modules/tree/master/docs +RUN set -xe \ + && buildDeps=" \ + make \ + automake \ + autotools-dev \ + libedit-dev \ + libjemalloc-dev \ + libncurses-dev \ + libpcre3-dev \ + libtool \ + pkg-config \ + python-docutils \ + python-sphinx \ + varnish-dev \ + " \ + # Update apt and get dependencies + && apt-get update -q -y \ + && apt-get install -q -y --no-install-recommends ca-certificates curl \ + \ + # Get offical Varnish package + && curl -s ${PACKAGECLOUD_URL} | bash \ + && apt-get install -q -y --allow-unauthenticated --no-install-recommends varnish $buildDeps \ + \ + # Install varnish modules + && curl -A "Docker" -o /tmp/varnish-modules.tar.gz -D - -L -s https://download.varnish-software.com/varnish-modules/varnish-modules-${VARNISH_MODULES_VERSION}.tar.gz \ + && tar zxpf /tmp/varnish-modules.tar.gz -C /tmp/ \ + && cd /tmp/varnish-modules-${VARNISH_MODULES_VERSION} \ + && ./configure \ + && make \ + # && make check \ + && make install \ + && rm -f /tmp/varnish-modules.tar.gz && rm -Rf /tmp/varnish-modules \ + \ + # Cleanup apt cache and remove build packages + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ + && rm -rf /var/lib/apt/lists/* COPY doc/varnish/vcl/varnish4.vcl /etc/varnish/default.vcl COPY doc/docker/entrypoint/varnish/parameters.vcl /etc/varnish/parameters.vcl -ENV VARNISH_MALLOC_SIZE="256M" - EXPOSE 80 6082 # CMD in shell form to be able to use env variables here