From 19db214fe5bca2e953f951af3a042409cc9bf24b Mon Sep 17 00:00:00 2001 From: Guillaume Quintard Date: Thu, 14 Apr 2022 00:07:38 +0200 Subject: [PATCH 1/3] [varnish] document install vmods --- varnish/content.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/varnish/content.md b/varnish/content.md index cbe6f389a585..65d4a6db7ee9 100644 --- a/varnish/content.md +++ b/varnish/content.md @@ -114,3 +114,40 @@ $ 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 down, 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 varnish:7.1 + +# set the user to root, and install build dependencies +USER root +RUN apt-get update; \ + apt-get -y install $VMOD_DEPS /pkgs/*.deb + +# install one, possibly multiple vmods +RUN 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 +RUN apt-get -y purge --auto-remove $VMOD_DEPS varnish-dev; \ + rm -rf /var/lib/apt/lists/* +USER varnish +``` + +### Alpine + +```dockerfile +FROM varnish:7.1-alpine + +# install build dependencies +USER root +apk add $VMOD_DEPS + +# install one, possibly multiple vmods +RUN install-vmod https://github.com/varnish/varnish-modules/releases/download/0.20.0/varnish-modules-0.20.0.tar.gz + +# clean up +RUN apk del --no-network $VMOD_DEPS +``` From d424aa1df7fa7ecf7bc68605478e6664e535137d Mon Sep 17 00:00:00 2001 From: guillaume quintard Date: Thu, 21 Apr 2022 22:36:34 +0200 Subject: [PATCH 2/3] [varnish] PR review suggestions thanks @yosifkit! Co-authored-by: yosifkit --- varnish/content.md | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/varnish/content.md b/varnish/content.md index 65d4a6db7ee9..6ee4afcb3905 100644 --- a/varnish/content.md +++ b/varnish/content.md @@ -115,7 +115,7 @@ $ docker run %%IMAGE%% varnishd -F -a :8080 -b 127.0.0.1:8181 -t 600 -p feature= 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 down, compile and install vmods while creating your own images. Note that images set the `ENV` variable `VMOD_DEPS` to ease the task further. +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 @@ -124,14 +124,15 @@ FROM varnish:7.1 # set the user to root, and install build dependencies USER root -RUN apt-get update; \ - apt-get -y install $VMOD_DEPS /pkgs/*.deb - +RUN set -e; \ + apt-get update; \ + apt-get -y install $VMOD_DEPS /pkgs/*.deb; \ + \ # install one, possibly multiple vmods -RUN install-vmod https://github.com/varnish/varnish-modules/releases/download/0.20.0/varnish-modules-0.20.0.tar.gz - + 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 -RUN apt-get -y purge --auto-remove $VMOD_DEPS varnish-dev; \ + apt-get -y purge --auto-remove $VMOD_DEPS varnish-dev; \ rm -rf /var/lib/apt/lists/* USER varnish ``` @@ -143,11 +144,13 @@ FROM varnish:7.1-alpine # install build dependencies USER root -apk add $VMOD_DEPS - +RUN set -e; \ + apk add --no-cache $VMOD_DEPS; \ + \ # install one, possibly multiple vmods -RUN install-vmod https://github.com/varnish/varnish-modules/releases/download/0.20.0/varnish-modules-0.20.0.tar.gz - + install-vmod https://github.com/varnish/varnish-modules/releases/download/0.20.0/varnish-modules-0.20.0.tar.gz; \ + \ # clean up -RUN apk del --no-network $VMOD_DEPS + apk del --no-network $VMOD_DEPS +USER varnish ``` From 82f71c760e3d4ecf001733333956bcf9d8e23296 Mon Sep 17 00:00:00 2001 From: guillaume quintard Date: Thu, 28 Apr 2022 10:22:24 -0700 Subject: [PATCH 3/3] [varnish] Apply suggestions from code review Co-authored-by: Tianon Gravi --- varnish/content.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/varnish/content.md b/varnish/content.md index 6ee4afcb3905..a16e0b383a49 100644 --- a/varnish/content.md +++ b/varnish/content.md @@ -120,7 +120,7 @@ On top of this, images include [install-vmod](https://github.com/varnish/toolbox ### Debian ```dockerfile -FROM varnish:7.1 +FROM %%IMAGE%%:7.1 # set the user to root, and install build dependencies USER root @@ -140,7 +140,7 @@ USER varnish ### Alpine ```dockerfile -FROM varnish:7.1-alpine +FROM %%IMAGE%%:7.1-alpine # install build dependencies USER root