Skip to content

Commit

Permalink
chore(files): Uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricios committed Dec 4, 2019
1 parent 741959c commit 2d97023
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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\"'"]
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2d97023

Please sign in to comment.