Skip to content

Commit

Permalink
add next/ in preparation of the March release
Browse files Browse the repository at this point in the history
  • Loading branch information
gquintard committed Jan 25, 2024
1 parent 0ed40cd commit 8e7065f
Show file tree
Hide file tree
Showing 12 changed files with 394 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fresh/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG VARNISH_MODULES_SHA512SUM=597ac1161224a25c11183fbaaf25412c8f8e0af3bf58fa761
ARG VMOD_DYNAMIC_VERSION=2.8.0-1
ARG VMOD_DYNAMIC_COMMIT=15e32fb8cf96752c90d895b0ca31451bd05d92d9
ARG VMOD_DYNAMIC_SHA512SUM=d62d7af87770ef370c2e78e5b464f4f7712ebb50281728ca157ff38303f5455f1afdc0f8efaf0040febdf2d0aedbfa4c3369fe0f9d634ed34f185b54876cb4d1
ARG TOOLBOX_COMMIT=01ff3ec18a955f93880afe18167f17d0bc36cd55
ARG TOOLBOX_COMMIT=cfa9ec43a47429ef94f7e04e4abc58c67ad50add
ENV VMOD_DEPS="autoconf-archive automake curl libtool make pkgconfig py3-sphinx"

ENV VARNISH_SIZE 100M
Expand Down
2 changes: 1 addition & 1 deletion fresh/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG VARNISH_MODULES_SHA512SUM=597ac1161224a25c11183fbaaf25412c8f8e0af3bf58fa761
ARG VMOD_DYNAMIC_VERSION=2.8.0-1
ARG VMOD_DYNAMIC_COMMIT=15e32fb8cf96752c90d895b0ca31451bd05d92d9
ARG VMOD_DYNAMIC_SHA512SUM=d62d7af87770ef370c2e78e5b464f4f7712ebb50281728ca157ff38303f5455f1afdc0f8efaf0040febdf2d0aedbfa4c3369fe0f9d634ed34f185b54876cb4d1
ARG TOOLBOX_COMMIT=01ff3ec18a955f93880afe18167f17d0bc36cd55
ARG TOOLBOX_COMMIT=cfa9ec43a47429ef94f7e04e4abc58c67ad50add
ENV VMOD_DEPS="autoconf-archive automake curl libtool make pkg-config python3-sphinx"

ENV VARNISH_SIZE 100M
Expand Down
73 changes: 73 additions & 0 deletions next/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
FROM alpine:3.19

ARG PKG_COMMIT=cfa8cb3724e4ca6398f60b09157715bcb99d189d
ARG VARNISH_VERSION=7.4.2
ARG DIST_SHA512=acd61a852ac7d66b268ab831d3a771d7a063a6a257b5e7c25c5a2ec9bccefa845279b9bd5fc85dd0b4f1d56da59164a13149355d1e6187e71ad76463687f7971
ARG VARNISH_MODULES_VERSION=0.22.0
ARG VARNISH_MODULES_SHA512SUM=597ac1161224a25c11183fbaaf25412c8f8e0af3bf58fa76161328d8ae97aa7c485cfa6ed50e9f24ce73eca9ddeeb87ee4998427382c0fce633bf43eaf08068a
ARG VMOD_DYNAMIC_VERSION=2.8.0-1
ARG VMOD_DYNAMIC_COMMIT=15e32fb8cf96752c90d895b0ca31451bd05d92d9
ARG VMOD_DYNAMIC_SHA512SUM=d62d7af87770ef370c2e78e5b464f4f7712ebb50281728ca157ff38303f5455f1afdc0f8efaf0040febdf2d0aedbfa4c3369fe0f9d634ed34f185b54876cb4d1
ARG TOOLBOX_COMMIT=cfa9ec43a47429ef94f7e04e4abc58c67ad50add
ENV VMOD_DEPS="autoconf-archive automake curl libtool make pkgconfig py3-sphinx"

ENV VARNISH_SIZE 100M

RUN set -e;\
BASE_PKGS="tar alpine-sdk sudo py3-docutils python3 autoconf automake libtool"; \
apk add --virtual varnish-build-deps -q --no-progress --update $BASE_PKGS; \
\
# create users and groups with fixed IDs
addgroup -g 1000 -S varnish; \
adduser -u 1000 -S -D -H -s /sbin/nologin -G varnish -g varnish varnish; \
adduser -u 1001 -S -D -H -s /sbin/nologin -G varnish -g varnish vcache; \
adduser -u 1002 -S -D -H -s /sbin/nologin -G varnish -g varnish varnishlog; \
\
adduser -D builder; \
echo "builder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder; \
addgroup builder abuild; \
su builder -c "abuild-keygen -nai"; \
\
# varnish tarball and packaging
git clone https://github.com/varnishcache/pkg-varnish-cache.git; \
cd pkg-varnish-cache/alpine; \
git checkout $PKG_COMMIT; \
sed -i APKBUILD \
-e "s/pkgver=@VERSION@/pkgver=$VARNISH_VERSION/" \
-e 's@^source=.*@source="http://varnish-cache.org/_downloads/varnish-$pkgver.tgz"@' \
-e "s/^sha512sums=.*/sha512sums=\"$DIST_SHA512 varnish-\$pkgver.tgz\"/"; \
\
# build and install varnish package
chown builder -R .; \
su builder -c "abuild -r"; \
apk add --allow-untrusted ~builder/packages/pkg-varnish-cache/*/*.apk; \
echo -e 'vcl 4.1;\nbackend default none;' > /etc/varnish/default.vcl; \
\
git clone https://github.com/varnish/toolbox.git; \
cd toolbox; \
git checkout $TOOLBOX_COMMIT; \
cp install-vmod/install-vmod /usr/local/bin/; \
cp vcls/verbose_builtin/verbose_builtin.vcl vcls/hit-miss/hit-miss.vcl /etc/varnish/; \
\
# varnish-modules
install-vmod https://github.com/varnish/varnish-modules/releases/download/$VARNISH_MODULES_VERSION/varnish-modules-$VARNISH_MODULES_VERSION.tar.gz $VARNISH_MODULES_SHA512SUM; \
\
# vmod-dynamic
install-vmod https://github.com/nigoroll/libvmod-dynamic/archive/$VMOD_DYNAMIC_COMMIT.tar.gz $VMOD_DYNAMIC_SHA512SUM; \
\
# cleanup
apk del --no-network varnish-build-deps; \
rm -rf ~builder /pkg-varnish-cache /varnish-modules /vmod-dynamic /etc/sudoers.d/builder; \
deluser --remove-home builder; \
chown varnish /var/lib/varnish;

WORKDIR /etc/varnish

COPY scripts/ /usr/local/bin/
COPY default.vcl /etc/varnish/

ENTRYPOINT ["/usr/local/bin/docker-varnish-entrypoint"]

USER varnish
EXPOSE 80 8443
CMD []
73 changes: 73 additions & 0 deletions next/alpine/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
FROM alpine:3.19

ARG PKG_COMMIT=@PKG_COMMIT@
ARG VARNISH_VERSION=@VARNISH_VERSION@
ARG DIST_SHA512=@DIST_SHA512@
ARG VARNISH_MODULES_VERSION=@VARNISH_MODULES_VERSION@
ARG VARNISH_MODULES_SHA512SUM=@VARNISH_MODULES_SHA512SUM@
ARG VMOD_DYNAMIC_VERSION=@VMOD_DYNAMIC_VERSION@
ARG VMOD_DYNAMIC_COMMIT=@VMOD_DYNAMIC_COMMIT@
ARG VMOD_DYNAMIC_SHA512SUM=@VMOD_DYNAMIC_SHA512SUM@
ARG TOOLBOX_COMMIT=@TOOLBOX_COMMIT@
ENV VMOD_DEPS="autoconf-archive automake curl libtool make pkgconfig py3-sphinx"

ENV VARNISH_SIZE 100M

RUN set -e;\
BASE_PKGS="tar alpine-sdk sudo py3-docutils python3 autoconf automake libtool"; \
apk add --virtual varnish-build-deps -q --no-progress --update $BASE_PKGS; \
\
# create users and groups with fixed IDs
addgroup -g 1000 -S varnish; \
adduser -u 1000 -S -D -H -s /sbin/nologin -G varnish -g varnish varnish; \
adduser -u 1001 -S -D -H -s /sbin/nologin -G varnish -g varnish vcache; \
adduser -u 1002 -S -D -H -s /sbin/nologin -G varnish -g varnish varnishlog; \
\
adduser -D builder; \
echo "builder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder; \
addgroup builder abuild; \
su builder -c "abuild-keygen -nai"; \
\
# varnish tarball and packaging
git clone https://github.com/varnishcache/pkg-varnish-cache.git; \
cd pkg-varnish-cache/alpine; \
git checkout $PKG_COMMIT; \
sed -i APKBUILD \
-e "s/pkgver=@VERSION@/pkgver=$VARNISH_VERSION/" \
-e 's@^source=.*@source="http://varnish-cache.org/_downloads/varnish-$pkgver.tgz"@' \
-e "s/^sha512sums=.*/sha512sums=\"$DIST_SHA512 varnish-\$pkgver.tgz\"/"; \
\
# build and install varnish package
chown builder -R .; \
su builder -c "abuild -r"; \
apk add --allow-untrusted ~builder/packages/pkg-varnish-cache/*/*.apk; \
echo -e 'vcl 4.1;\nbackend default none;' > /etc/varnish/default.vcl; \
\
git clone https://github.com/varnish/toolbox.git; \
cd toolbox; \
git checkout $TOOLBOX_COMMIT; \
cp install-vmod/install-vmod /usr/local/bin/; \
cp vcls/verbose_builtin/verbose_builtin.vcl vcls/hit-miss/hit-miss.vcl /etc/varnish/; \
\
# varnish-modules
install-vmod https://github.com/varnish/varnish-modules/releases/download/$VARNISH_MODULES_VERSION/varnish-modules-$VARNISH_MODULES_VERSION.tar.gz $VARNISH_MODULES_SHA512SUM; \
\
# vmod-dynamic
install-vmod https://github.com/nigoroll/libvmod-dynamic/archive/$VMOD_DYNAMIC_COMMIT.tar.gz $VMOD_DYNAMIC_SHA512SUM; \
\
# cleanup
apk del --no-network varnish-build-deps; \
rm -rf ~builder /pkg-varnish-cache /varnish-modules /vmod-dynamic /etc/sudoers.d/builder; \
deluser --remove-home builder; \
chown varnish /var/lib/varnish;

WORKDIR /etc/varnish

COPY scripts/ /usr/local/bin/
COPY default.vcl /etc/varnish/

ENTRYPOINT ["/usr/local/bin/docker-varnish-entrypoint"]

USER varnish
EXPOSE 80 8443
CMD []
52 changes: 52 additions & 0 deletions next/alpine/default.vcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Important documentation links:
# - general entry point: https://www.varnish-cache.org/docs/
# - VCL primer: https://varnish-cache.org/docs/2.1/tutorial/vcl.html
# - more VCL information: https://www.varnish-software.com/developers/tutorials/varnish-configuration-language-vcl/
# - logging: https://docs.varnish-software.com/tutorials/vsl-query/

vcl 4.1;

# https://github.com/varnish/toolbox/tree/master/vcls/hit-miss
include "hit-miss.vcl";

# Before you configure anything, we just disable the backend to avoid
# any mistake, but you can delete that line and uncomment the following
# ones to define a proper backend to fetch content from
backend default none;

#backend default {
# .host = "127.0.0.1";
# .port = "8080";
#}

# VCL allows you to implement a series of callback to dictate how to process
# each request. vcl_recv is the first one being called, right after Varnish
# receives some request headers. It's usually used to sanitize the request
sub vcl_recv {
# if no backend is configured, generate a welcome message by sending
# processing to `vcl_synth
if (!req.backend_hint) {
return(synth(200));
}
}

# Just fill the response body and deliver it
sub vcl_synth {
synthetic("""<!DOCTYPE html>
<html><body>
<h1>Varnish is running!</h1>
<p>Please edit <code>/etc/varnish/default.vcl</code> to setup a backend.</p>
</body></html>""");
return (deliver);
}

# if no synthetic response was generated, the request will go the the backend.
# vcl_backend_response is your chance to sanitize the response and possibly to
# set a TTL
sub vcl_backend_response {
}

# https://github.com/varnish/toolbox/tree/master/vcls/verbose_builtin
include "verbose_builtin.vcl";
18 changes: 18 additions & 0 deletions next/alpine/scripts/docker-varnish-entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -e

# this will check if the first argument is a flag
# but only works if all arguments require a hyphenated flag
# -v; -SL; -f arg; etc will work, but not arg1 arg2
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
set -- varnishd \
-F \
-f /etc/varnish/default.vcl \
-a http=:${VARNISH_HTTP_PORT:-80},HTTP \
-a proxy=:${VARNISH_PROXY_PORT:-8443},PROXY \
-p feature=+http2 \
-s malloc,$VARNISH_SIZE \
"$@"
fi

exec "$@"
71 changes: 71 additions & 0 deletions next/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
FROM debian:bookworm-slim

ARG PKG_COMMIT=cfa8cb3724e4ca6398f60b09157715bcb99d189d
ARG VARNISH_VERSION=7.4.2
ARG DIST_SHA512=acd61a852ac7d66b268ab831d3a771d7a063a6a257b5e7c25c5a2ec9bccefa845279b9bd5fc85dd0b4f1d56da59164a13149355d1e6187e71ad76463687f7971
ARG VARNISH_MODULES_VERSION=0.22.0
ARG VARNISH_MODULES_SHA512SUM=597ac1161224a25c11183fbaaf25412c8f8e0af3bf58fa76161328d8ae97aa7c485cfa6ed50e9f24ce73eca9ddeeb87ee4998427382c0fce633bf43eaf08068a
ARG VMOD_DYNAMIC_VERSION=2.8.0-1
ARG VMOD_DYNAMIC_COMMIT=15e32fb8cf96752c90d895b0ca31451bd05d92d9
ARG VMOD_DYNAMIC_SHA512SUM=d62d7af87770ef370c2e78e5b464f4f7712ebb50281728ca157ff38303f5455f1afdc0f8efaf0040febdf2d0aedbfa4c3369fe0f9d634ed34f185b54876cb4d1
ARG TOOLBOX_COMMIT=cfa9ec43a47429ef94f7e04e4abc58c67ad50add
ENV VMOD_DEPS="autoconf-archive automake curl libtool make pkg-config python3-sphinx"

ENV VARNISH_SIZE 100M

RUN set -e; \
BASE_PKGS="curl dpkg-dev debhelper devscripts equivs git pkg-config apt-utils fakeroot libgetdns-dev"; \
export DEBIAN_FRONTEND=noninteractive; \
export DEBCONF_NONINTERACTIVE_SEEN=true; \
mkdir -p /work/varnish /pkgs; \
apt-get update; \
apt-get install -y --no-install-recommends $BASE_PKGS libgetdns10; \
\
# create users and groups with fixed IDs
adduser --uid 1000 --quiet --system --no-create-home --home /nonexistent --group varnish; \
adduser --uid 1001 --quiet --system --no-create-home --home /nonexistent --ingroup varnish vcache; \
adduser --uid 1002 --quiet --system --no-create-home --home /nonexistent --ingroup varnish varnishlog; \
\
# varnish
cd /work/varnish; \
git clone https://github.com/varnishcache/pkg-varnish-cache.git; \
cd pkg-varnish-cache; \
git checkout cfa8cb3724e4ca6398f60b09157715bcb99d189d; \
rm -rf .git; \
curl -f https://varnish-cache.org/downloads/varnish-7.4.2.tgz -o $tmpdir/orig.tgz; \
echo "acd61a852ac7d66b268ab831d3a771d7a063a6a257b5e7c25c5a2ec9bccefa845279b9bd5fc85dd0b4f1d56da59164a13149355d1e6187e71ad76463687f7971 $tmpdir/orig.tgz" | sha512sum -c -; \
tar xavf $tmpdir/orig.tgz --strip 1; \
sed -i -e "s|@VERSION@|$VARNISH_VERSION|" "debian/changelog"; \
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --yes" debian/control; \
sed -i '' debian/varnish*; \
dpkg-buildpackage -us -uc -j"$(nproc)"; \
apt-get -y --no-install-recommends install ../*.deb; \
mv ../*dev*.deb /pkgs; \
\
git clone https://github.com/varnish/toolbox.git; \
cd toolbox; \
git checkout $TOOLBOX_COMMIT; \
cp install-vmod/install-vmod /usr/local/bin/; \
cp vcls/verbose_builtin/verbose_builtin.vcl vcls/hit-miss/hit-miss.vcl /etc/varnish/; \
\
# varnish-modules
install-vmod https://github.com/varnish/varnish-modules/releases/download/$VARNISH_MODULES_VERSION/varnish-modules-$VARNISH_MODULES_VERSION.tar.gz $VARNISH_MODULES_SHA512SUM; \
\
# vmod-dynamic
install-vmod https://github.com/nigoroll/libvmod-dynamic/archive/$VMOD_DYNAMIC_COMMIT.tar.gz $VMOD_DYNAMIC_SHA512SUM; \
\
# clean up
apt-get -y purge --auto-remove varnish-build-deps $BASE_PKGS; \
rm -rf /var/lib/apt/lists/* /work/ /usr/lib/varnish/vmods/libvmod_*.la; \
chown varnish /var/lib/varnish;

WORKDIR /etc/varnish

COPY scripts/ /usr/local/bin/
COPY default.vcl /etc/varnish/

ENTRYPOINT ["/usr/local/bin/docker-varnish-entrypoint"]

USER varnish
EXPOSE 80 8443
CMD []
71 changes: 71 additions & 0 deletions next/debian/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
FROM debian:@DEBIAN@-slim

ARG PKG_COMMIT=@PKG_COMMIT@
ARG VARNISH_VERSION=@VARNISH_VERSION@
ARG DIST_SHA512=@DIST_SHA512@
ARG VARNISH_MODULES_VERSION=@VARNISH_MODULES_VERSION@
ARG VARNISH_MODULES_SHA512SUM=@VARNISH_MODULES_SHA512SUM@
ARG VMOD_DYNAMIC_VERSION=@VMOD_DYNAMIC_VERSION@
ARG VMOD_DYNAMIC_COMMIT=@VMOD_DYNAMIC_COMMIT@
ARG VMOD_DYNAMIC_SHA512SUM=@VMOD_DYNAMIC_SHA512SUM@
ARG TOOLBOX_COMMIT=@TOOLBOX_COMMIT@
ENV VMOD_DEPS="autoconf-archive automake curl libtool make pkg-config python3-sphinx"

ENV VARNISH_SIZE 100M

RUN set -e; \
BASE_PKGS="curl dpkg-dev debhelper devscripts equivs git pkg-config apt-utils fakeroot libgetdns-dev"; \
export DEBIAN_FRONTEND=noninteractive; \
export DEBCONF_NONINTERACTIVE_SEEN=true; \
mkdir -p /work/varnish /pkgs; \
apt-get update; \
apt-get install -y --no-install-recommends $BASE_PKGS libgetdns10; \
\
# create users and groups with fixed IDs
adduser --uid 1000 --quiet --system --no-create-home --home /nonexistent --group varnish; \
adduser --uid 1001 --quiet --system --no-create-home --home /nonexistent --ingroup varnish vcache; \
adduser --uid 1002 --quiet --system --no-create-home --home /nonexistent --ingroup varnish varnishlog; \
\
# varnish
cd /work/varnish; \
git clone https://github.com/varnishcache/pkg-varnish-cache.git; \
cd pkg-varnish-cache; \
git checkout @PKG_COMMIT@; \
rm -rf .git; \
curl -f https://varnish-cache.org/downloads/varnish-@VARNISH_VERSION@.tgz -o $tmpdir/orig.tgz; \
echo "@DIST_SHA512@ $tmpdir/orig.tgz" | sha512sum -c -; \
tar xavf $tmpdir/orig.tgz --strip 1; \
sed -i -e "s|@VERSION@|$VARNISH_VERSION|" "debian/changelog"; \
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --yes" debian/control; \
sed -i '' debian/varnish*; \
dpkg-buildpackage -us -uc -j"$(nproc)"; \
apt-get -y --no-install-recommends install ../*.deb; \
mv ../*dev*.deb /pkgs; \
\
git clone https://github.com/varnish/toolbox.git; \
cd toolbox; \
git checkout $TOOLBOX_COMMIT; \
cp install-vmod/install-vmod /usr/local/bin/; \
cp vcls/verbose_builtin/verbose_builtin.vcl vcls/hit-miss/hit-miss.vcl /etc/varnish/; \
\
# varnish-modules
install-vmod https://github.com/varnish/varnish-modules/releases/download/$VARNISH_MODULES_VERSION/varnish-modules-$VARNISH_MODULES_VERSION.tar.gz $VARNISH_MODULES_SHA512SUM; \
\
# vmod-dynamic
install-vmod https://github.com/nigoroll/libvmod-dynamic/archive/$VMOD_DYNAMIC_COMMIT.tar.gz $VMOD_DYNAMIC_SHA512SUM; \
\
# clean up
apt-get -y purge --auto-remove varnish-build-deps $BASE_PKGS; \
rm -rf /var/lib/apt/lists/* /work/ /usr/lib/varnish/vmods/libvmod_*.la; \
chown varnish /var/lib/varnish;

WORKDIR /etc/varnish

COPY scripts/ /usr/local/bin/
COPY default.vcl /etc/varnish/

ENTRYPOINT ["/usr/local/bin/docker-varnish-entrypoint"]

USER varnish
EXPOSE 80 8443
CMD []
Loading

0 comments on commit 8e7065f

Please sign in to comment.