diff --git a/varnish/content.md b/varnish/content.md index cbe6f389a585..a16e0b383a49 100644 --- a/varnish/content.md +++ b/varnish/content.md @@ -114,3 +114,43 @@ $ docker run %%IMAGE%% varnishd -F -a :8080 -b 127.0.0.1:8181 -t 600 -p feature= ## vmods (since 7.1) As mentioned above, you can use [vmod_dynamic](https://github.com/nigoroll/libvmod-dynamic) for backend resolution. The [varnish-modules](https://github.com/varnish/varnish-modules) collection is also included in the image. All the documentation regarding usage and syntax can be found in the [src/](https://github.com/varnish/varnish-modules/tree/master/src) directory of the repository. + +On top of this, images include [install-vmod](https://github.com/varnish/toolbox/tree/master/install-vmod), a helper script to quickly download, compile and install vmods while creating your own images. Note that images set the `ENV` variable `VMOD_DEPS` to ease the task further. + +### Debian + +```dockerfile +FROM %%IMAGE%%:7.1 + +# set the user to root, and install build dependencies +USER root +RUN set -e; \ + apt-get update; \ + apt-get -y install $VMOD_DEPS /pkgs/*.deb; \ + \ +# install one, possibly multiple vmods + install-vmod https://github.com/varnish/varnish-modules/releases/download/0.20.0/varnish-modules-0.20.0.tar.gz; \ + \ +# clean up and set the user back to varnish + apt-get -y purge --auto-remove $VMOD_DEPS varnish-dev; \ + rm -rf /var/lib/apt/lists/* +USER varnish +``` + +### Alpine + +```dockerfile +FROM %%IMAGE%%:7.1-alpine + +# install build dependencies +USER root +RUN set -e; \ + apk add --no-cache $VMOD_DEPS; \ + \ +# install one, possibly multiple vmods + install-vmod https://github.com/varnish/varnish-modules/releases/download/0.20.0/varnish-modules-0.20.0.tar.gz; \ + \ +# clean up + apk del --no-network $VMOD_DEPS +USER varnish +```