Skip to content

Instantly share code, notes, and snippets.

@cosimo
Created May 6, 2024 12:28
Show Gist options
  • Save cosimo/f4e24cfdc4f474aec51e05ab805b5486 to your computer and use it in GitHub Desktop.
Save cosimo/f4e24cfdc4f474aec51e05ab805b5486 to your computer and use it in GitHub Desktop.
Dockerfile to build varnish modules and vmod_dynamic
# Build the dynamic and vsthrottle Varnish modules from source.
FROM ubuntu:20.04
ENV TZ=Etc/UTC
ENV VARNISH_VERSION 7.4
# Avoid tzdata terminal configuration that would halt the build
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update -qq
RUN apt-get install -y python3 python3-docutils python3-sphinx libpcre2-dev libreadline-dev autoconf make automake libtool git-core pkg-config libvarnishapi2
# libgetdns-dev needs to be installed for libvmod-dynamic configure script
# to pick it up and enable the resolver objects.
RUN apt-get install -y libgetdns-dev libgetdns10
RUN mkdir -p /app \
&& cd /app \
&& git clone https://github.com/varnishcache/varnish-cache \
&& cd varnish-cache \
&& git checkout ${VARNISH_VERSION} \
&& ./autogen.sh && ./configure --prefix=/usr \
&& make -j8 \
&& make install \
&& cp -p varnishapi.pc /usr/lib/pkgconfig/ \
&& cp -p varnish.m4 /usr/share/aclocal/
RUN mkdir -p /app \
&& cd /app \
&& git clone https://github.com/nigoroll/libvmod-dynamic \
&& cd libvmod-dynamic \
&& git checkout ${VARNISH_VERSION} \
&& ./autogen.sh \
&& ./configure --prefix=/usr \
&& make \
&& make install \
&& ls -l src/.libs/libvmod_dynamic.so
RUN mkdir -p /app \
&& cd /app \
&& git clone https://github.com/varnish/varnish-modules \
&& cd varnish-modules \
&& git checkout ${VARNISH_VERSION} \
&& ./bootstrap \
&& ./configure --prefix=/usr \
&& make \
&& make install \
&& ls -l src/.libs/libvmod_vsthrottle.so
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment