From 2d9702378827975840adc2c7f0e028156ce67151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mauricio=20S=C3=A1nchez?= Date: Wed, 4 Dec 2019 04:47:45 +0000 Subject: [PATCH] chore(files): Uploading --- Dockerfile | 28 ++++++++++++++++++++++++++++ README.md | 7 +++++++ 2 files changed, 35 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c69eb4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM cooptilleuls/varnish:6.2.0-alpine +LABEL maintainer="Aplyca" description="Varnish image with VMOD dynamic" + +# Define env vars for VMOD build +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig +ENV ACLOCAL_PATH /usr/local/share/aclocal + +# Install build dependencies; download, build and install the VMOD; +# then remove build dependencies to keep the docker layer as small as possible. +RUN set -eux; \ + apk add --quiet --progress --update --no-cache --virtual .vmod-build-deps autoconf automake libexecinfo-dev libtool make pcre-dev pkgconf py-docutils python3 && \ + wget "https://github.com/nigoroll/libvmod-dynamic/archive/6.2.zip" -O /tmp/libvmod-dynamic.zip && \ + unzip -d /tmp /tmp/libvmod-dynamic.zip && \ + cd "/tmp/libvmod-dynamic-6.2" && \ + chmod +x ./autogen.sh && \ + ./autogen.sh && \ + ./configure --prefix=/usr/local && \ + make -j "$(nproc)" && \ + make install && \ + cd / && \ + rm -rf /tmp/libvmod-dynamic* && \ + apk del --purge .vmod-build-deps autoconf automake make libexecinfo-dev pcre-dev + +WORKDIR /app +ENV VARNISH_MEMORY 80M + +# Run varnish and also print logs on stdout +CMD ["/bin/sh", "-o", "pipefail", "-c", "varnishd -F -f /usr/local/share/varnish/vcl/default.vcl -s malloc,${VARNISH_MEMORY} | varnishncsa -F '%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{Varnish:handling}x\"'"] \ No newline at end of file diff --git a/README.md b/README.md index f0a29fb..e832656 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # docker-varnish + Docker build of Varnish HTTP accelerator + +- Alpine +- Varnish 6.2 +- Libvmod Dynamic + +Inspired in this blog post: https://knplabs.com/en/blog/how2tip-varnish-dynamic-backend-dns-resolution-in-a-docker-swarm-context