-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
221 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# syntax=docker/dockerfile:experimental | ||
FROM debian:bookworm-slim | ||
LABEL org.opencontainers.image.source = "https://github.com/emgag/docker-varnish" | ||
|
||
# | ||
# install varnish build deps | ||
# | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
autoconf-archive \ | ||
automake \ | ||
autotools-dev \ | ||
build-essential \ | ||
ca-certificates \ | ||
curl \ | ||
git \ | ||
libedit-dev \ | ||
libgetdns-dev \ | ||
libjemalloc-dev \ | ||
libmhash-dev \ | ||
libncurses-dev \ | ||
libpcre2-8-0 \ | ||
libpcre2-dev \ | ||
libpcre3-dev \ | ||
libreadline-dev \ | ||
libtool \ | ||
liburing-dev \ | ||
libxxhash-dev \ | ||
pkg-config \ | ||
python3 \ | ||
python3-docutils \ | ||
python3-sphinx \ | ||
&& apt-get autoremove -y | ||
|
||
# | ||
# install varnish | ||
# | ||
ENV VARNISH_VERSION=7.5.0 | ||
ENV VARNISH_SHA256SUM=fca61b983139e1aac61c4546d12a1a3ab9807dbb1d8314571e3148c93ff72b5d | ||
ENV VARNISHSRC=/usr/local/src/varnish-${VARNISH_VERSION} | ||
|
||
RUN mkdir -p /usr/local/src && \ | ||
cd /usr/local/src && \ | ||
curl -sfLO https://varnish-cache.org/_downloads/varnish-${VARNISH_VERSION}.tgz && \ | ||
echo "${VARNISH_SHA256SUM} varnish-${VARNISH_VERSION}.tgz" | sha256sum -c - && \ | ||
tar -xzf varnish-${VARNISH_VERSION}.tgz && \ | ||
rm varnish-${VARNISH_VERSION}.tgz && \ | ||
cd varnish-${VARNISH_VERSION} && \ | ||
./autogen.sh && \ | ||
./configure && \ | ||
make install | ||
|
||
# | ||
# install stock varnish module library | ||
# | ||
ENV VARNISHMODULES_VERSION=0.24.0 | ||
ENV VARNISHMODULES_SHA256SUM=b44fc6d99a057ab85c01fc1dad1a625608d76971700201ec0f186fff147fe798 | ||
|
||
RUN cd /usr/local/src/ && \ | ||
curl -sfLO https://github.com/varnish/varnish-modules/archive/${VARNISHMODULES_VERSION}.tar.gz && \ | ||
echo "${VARNISHMODULES_SHA256SUM} ${VARNISHMODULES_VERSION}.tar.gz" | sha256sum -c - && \ | ||
tar -xzf ${VARNISHMODULES_VERSION}.tar.gz && \ | ||
cd varnish-modules-${VARNISHMODULES_VERSION} && \ | ||
./bootstrap && \ | ||
./configure && \ | ||
make install && \ | ||
cd /usr/local/src && \ | ||
rm ${VARNISHMODULES_VERSION}.tar.gz \ | ||
rm -rf varnish-modules-${VARNISHMODULES_VERSION} && \ | ||
ldconfig | ||
|
||
# | ||
# install libvmod-dynamic | ||
# | ||
ENV LIBVMOD_DYNAMIC_BRANCH=master | ||
ENV LIBVMOD_DYNAMIC_COMMIT=32c331e79dba857b0309ba0d527ba17bf64ff2c7 | ||
|
||
RUN cd /usr/local/src/ && \ | ||
git clone -b ${LIBVMOD_DYNAMIC_BRANCH} https://github.com/nigoroll/libvmod-dynamic.git && \ | ||
cd libvmod-dynamic && \ | ||
git reset --hard ${LIBVMOD_DYNAMIC_COMMIT} && \ | ||
./autogen.sh && \ | ||
./configure && \ | ||
make install && \ | ||
cd /usr/local/src && \ | ||
rm -rf libvmod-dynamic && \ | ||
ldconfig | ||
|
||
# | ||
# install libvmod-digest | ||
# | ||
ENV LIBVMOD_DIGEST_VERSION=1.0.3 | ||
ENV LIBVMOD_DIGEST_SHA256SUM=872fd18aa672609195c0dc128ca29e1a1b3a11924c71a34ed7fd956f9177111c | ||
|
||
RUN cd /usr/local/src/ && \ | ||
curl -sfLO https://github.com/varnish/libvmod-digest/archive/libvmod-digest-${LIBVMOD_DIGEST_VERSION}.tar.gz && \ | ||
echo "${LIBVMOD_DIGEST_SHA256SUM} libvmod-digest-${LIBVMOD_DIGEST_VERSION}.tar.gz" | sha256sum -c - && \ | ||
tar -xzf libvmod-digest-${LIBVMOD_DIGEST_VERSION}.tar.gz && \ | ||
cd libvmod-digest-libvmod-digest-${LIBVMOD_DIGEST_VERSION} && \ | ||
./autogen.sh && \ | ||
./configure && \ | ||
make install && \ | ||
cd /usr/local/src && \ | ||
rm -rf libvmod-digest* && \ | ||
ldconfig | ||
|
||
# | ||
# install libvmod-querystring | ||
# | ||
ENV LIBVMOD_QUERYSTRING_VERSION=2.0.3 | ||
ENV LIBVMOD_QUERYSTRING_SHA256SUM=ec325d64241580ed136660f1d27cecd874b663431ac3abdb2d28e1ac6f4811e4 | ||
|
||
RUN cd /usr/local/src/ && \ | ||
curl -sfLO https://github.com/Dridi/libvmod-querystring/releases/download/v${LIBVMOD_QUERYSTRING_VERSION}/vmod-querystring-${LIBVMOD_QUERYSTRING_VERSION}.tar.gz && \ | ||
echo "${LIBVMOD_QUERYSTRING_SHA256SUM} vmod-querystring-${LIBVMOD_QUERYSTRING_VERSION}.tar.gz" | sha256sum -c - && \ | ||
tar -xzf vmod-querystring-${LIBVMOD_QUERYSTRING_VERSION}.tar.gz && \ | ||
cd vmod-querystring-${LIBVMOD_QUERYSTRING_VERSION} && \ | ||
./configure && \ | ||
make install && \ | ||
cd /usr/local/src && \ | ||
rm -rf vmod-querystring* && \ | ||
ldconfig | ||
|
||
# | ||
# install slash storage engines | ||
# | ||
#ENV SLASH_BRANCH=master | ||
#ENV SLASH_COMMIT=c250c9cd3cbb9b751aa230ca6b72c2937b5ff656 | ||
# | ||
#RUN cd /usr/local/src/ && \ | ||
# git clone -b ${SLASH_BRANCH} https://gitlab.com/uplex/varnish/slash.git && \ | ||
# cd slash && \ | ||
# git reset --hard ${SLASH_COMMIT} && \ | ||
# ./bootstrap && \ | ||
# make check && \ | ||
# make install && \ | ||
# cd /usr/local/src && \ | ||
# rm -rf slash && \ | ||
# ldconfig | ||
|
||
# init | ||
COPY init.sh /init.sh | ||
|
||
RUN useradd -r -s /bin/false vcache | ||
RUN mkdir /etc/varnish | ||
|
||
ENV VARNISH_CONFIG /etc/varnish/default.vcl | ||
ENV VARNISH_STORAGE malloc,100m | ||
ENV VARNISH_LISTEN :80 | ||
ENV VARNISH_MANAGEMENT_LISTEN 127.0.0.1:6082 | ||
|
||
EXPOSE 80 | ||
EXPOSE 6082 | ||
|
||
CMD ["/init.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
exec varnishd \ | ||
-j unix,user=vcache \ | ||
-F \ | ||
-f ${VARNISH_CONFIG} \ | ||
-s ${VARNISH_STORAGE} \ | ||
-a ${VARNISH_LISTEN} \ | ||
-T ${VARNISH_MANAGEMENT_LISTEN} \ | ||
${VARNISH_DAEMON_OPTS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
vcl 4.0; | ||
|
||
import blob; | ||
import bodyaccess; | ||
import cookie; | ||
import debug; | ||
import digest; | ||
import directors; | ||
import dynamic; | ||
import header; | ||
import proxy; | ||
import purge; | ||
import querystring; | ||
import saintmode; | ||
import std; | ||
import tcp; | ||
import unix; | ||
import var; | ||
import vsthrottle; | ||
import vtc; | ||
import xkey; | ||
|
||
backend default { | ||
.host = "127.0.0.1"; | ||
.port = "8080"; | ||
} | ||
|
||
sub vcl_recv { | ||
std.log("you can't stop the signal!"); | ||
} |