Răsfoiți Sursa

[varnish] document install vmods (#2134)

guillaume quintard 3 ani în urmă
părinte
comite
b41d0f8224
1 a modificat fișierele cu 40 adăugiri și 0 ștergeri
  1. 40 0
      varnish/content.md

+ 40 - 0
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
+```