├── .travis.yml ├── 4.1 ├── alpine3.8 │ ├── Dockerfile │ ├── docker-varnish-entrypoint │ ├── fix-compat-execinfo.patch │ ├── fix-stack-overflow.patch │ ├── musl-mode_t.patch │ └── varnish-4.1.3_fix_Werror_el6.patch └── stretch │ ├── Dockerfile │ └── docker-varnish-entrypoint ├── 6.0 ├── alpine3.8 │ ├── Dockerfile │ ├── docker-varnish-entrypoint │ ├── musl-include-vpf.patch │ └── musl-include-vsb.patch └── stretch │ ├── Dockerfile │ └── docker-varnish-entrypoint ├── 6.2 ├── alpine3.8 │ ├── Dockerfile │ ├── docker-varnish-entrypoint │ ├── musl-include-vpf.patch │ └── musl-include-vsb.patch └── stretch │ ├── Dockerfile │ └── docker-varnish-entrypoint ├── AUTHORS.md ├── Dockerfile-alpine.template ├── Dockerfile-debian.template ├── LICENSE ├── README-short.txt ├── README.md ├── docker-varnish-entrypoint ├── generate-stackbrew-library.sh └── update.sh /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | services: docker 3 | 4 | env: 5 | - VERSION=6.2 VARIANT=stretch 6 | - VERSION=6.2 VARIANT=alpine3.8 7 | - VERSION=6.0 VARIANT=stretch 8 | - VERSION=6.0 VARIANT=alpine3.8 9 | - VERSION=4.1 VARIANT=stretch 10 | - VERSION=4.1 VARIANT=alpine3.8 11 | 12 | install: 13 | - git clone https://github.com/docker-library/official-images.git ~/official-images 14 | 15 | before_script: 16 | - env | sort 17 | - cd "$VERSION/$VARIANT" 18 | - image="varnish:${VERSION}-${VARIANT}" 19 | 20 | script: 21 | - travis_retry docker build -t "$image" . 22 | - ~/official-images/test/run.sh "$image" 23 | 24 | after_script: 25 | - docker images 26 | -------------------------------------------------------------------------------- /4.1/alpine3.8/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.8 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | addgroup -S varnish; \ 12 | for user in varnish vcache; do \ 13 | adduser -S -G varnish $user; \ 14 | done 15 | 16 | # dependencies required for building VMOD (Varnish modules) 17 | ENV VMOD_BUILD_DEPS \ 18 | autoconf \ 19 | # autoconf-archive \ 20 | automake \ 21 | libtool \ 22 | make \ 23 | pkgconf \ 24 | python3 25 | 26 | # persistent / runtime deps 27 | RUN apk add --no-cache --virtual .persistent-deps \ 28 | gcc \ 29 | libc-dev \ 30 | libgcc 31 | 32 | ENV VARNISH_VERSION 4.1.11 33 | ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-4.1.11.tgz 34 | ENV VARNISH_SHA256 f937a45116f3a7fbb38b2b5d7137658a4846409630bb9eccdbbb240e1a1379bc 35 | 36 | COPY *.patch /varnish-alpine-patches/ 37 | 38 | RUN set -eux; \ 39 | \ 40 | fetchDeps=' \ 41 | ca-certificates \ 42 | wget \ 43 | '; \ 44 | buildDeps=" \ 45 | $VMOD_BUILD_DEPS \ 46 | coreutils \ 47 | dpkg \ 48 | dpkg-dev \ 49 | libedit-dev \ 50 | libexecinfo-dev \ 51 | linux-headers \ 52 | ncurses-dev \ 53 | patch \ 54 | pcre-dev \ 55 | "; \ 56 | apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ 57 | \ 58 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 59 | \ 60 | if [ -n "$VARNISH_SHA256" ]; then \ 61 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 62 | fi; \ 63 | \ 64 | mkdir -p /usr/src/varnish; \ 65 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 66 | rm varnish.tar.gz; \ 67 | \ 68 | cd /usr/src/varnish; \ 69 | for p in /varnish-alpine-patches/*.patch; do \ 70 | [ -f "$p" ] || continue; \ 71 | patch -p1 -i "$p"; \ 72 | done; \ 73 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 74 | ./autogen.sh; \ 75 | ./configure \ 76 | --build="$gnuArch" \ 77 | --without-jemalloc \ 78 | --with-rst2man=$(command -v true) \ 79 | --with-sphinx-build=$(command -v true) \ 80 | ; \ 81 | make -j "$(nproc)"; \ 82 | make install; \ 83 | \ 84 | cd /; \ 85 | rm -r /usr/src/varnish; \ 86 | \ 87 | runDeps="$( \ 88 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 89 | | tr ',' '\n' \ 90 | | sort -u \ 91 | | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 92 | )"; \ 93 | apk add --no-cache --virtual .varnish-rundeps $runDeps; \ 94 | \ 95 | apk del .build-deps; \ 96 | \ 97 | varnishd -V 98 | 99 | WORKDIR /usr/local/var/varnish 100 | RUN chown -R varnish:varnish /usr/local/var/varnish 101 | VOLUME /usr/local/var/varnish 102 | 103 | COPY docker-varnish-entrypoint /usr/local/bin/ 104 | ENTRYPOINT ["docker-varnish-entrypoint"] 105 | 106 | EXPOSE 80 107 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 108 | -------------------------------------------------------------------------------- /4.1/alpine3.8/docker-varnish-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- varnishd "$@" 7 | fi 8 | 9 | # allow the container to be started with `--user` 10 | if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then 11 | chown -R varnish:varnish . 12 | fi 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /4.1/alpine3.8/fix-compat-execinfo.patch: -------------------------------------------------------------------------------- 1 | --- varnish-4.0.2.orig/lib/libvarnishcompat/execinfo.c 2 | +++ varnish-4.0.2/lib/libvarnishcompat/execinfo.c 3 | @@ -30,7 +30,7 @@ 4 | 5 | #include "compat/execinfo.h" 6 | 7 | -#if defined (__GNUC__) && __GNUC__ >= 4 /* XXX Correct version to check for ? */ 8 | +#if !defined(__arm__) && defined (__GNUC__) && __GNUC__ >= 4 /* XXX Correct version to check for ? */ 9 | 10 | #include 11 | #include 12 | -------------------------------------------------------------------------------- /4.1/alpine3.8/fix-stack-overflow.patch: -------------------------------------------------------------------------------- 1 | From f88f2ead8cc5958262d333c46e94ddc8a3c9ae18 Mon Sep 17 00:00:00 2001 2 | From: Natanael Copa 3 | Date: Tue, 21 Nov 2017 12:10:34 +0100 4 | Subject: [PATCH] fix stack overflow in epoll waiter 5 | 6 | musl libc has a default thread stack of 80k. avoid overflow the stack by 7 | allocating the epol_event array on heap instead of stack. 8 | --- 9 | bin/varnishd/waiter/cache_waiter_epoll.c | 5 ++++- 10 | 1 file changed, 4 insertions(+), 1 deletion(-) 11 | 12 | diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c 13 | index 71c426a..ccbc64c 100644 14 | --- a/bin/varnishd/waiter/cache_waiter_epoll.c 15 | +++ b/bin/varnishd/waiter/cache_waiter_epoll.c 16 | @@ -74,7 +74,7 @@ struct vwe { 17 | static void * 18 | vwe_thread(void *priv) 19 | { 20 | - struct epoll_event ev[NEEV], *ep; 21 | + struct epoll_event *ev, *ep; 22 | struct waited *wp; 23 | struct waiter *w; 24 | double now, then; 25 | @@ -87,6 +87,8 @@ vwe_thread(void *priv) 26 | CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); 27 | THR_SetName("cache-epoll"); 28 | THR_Init(); 29 | + ev = malloc(NEEV * sizeof(struct epoll_event)); 30 | + assert(ev != NULL); 31 | 32 | now = VTIM_real(); 33 | while (1) { 34 | @@ -154,6 +156,7 @@ vwe_thread(void *priv) 35 | AZ(close(vwe->pipe[0])); 36 | AZ(close(vwe->pipe[1])); 37 | AZ(close(vwe->epfd)); 38 | + free(ev); 39 | return (NULL); 40 | } 41 | 42 | -- 43 | 2.13.5 44 | 45 | -------------------------------------------------------------------------------- /4.1/alpine3.8/musl-mode_t.patch: -------------------------------------------------------------------------------- 1 | --- ./include/vpf.h.orig 2 | +++ ./include/vpf.h 3 | @@ -30,6 +30,8 @@ 4 | #ifndef VPF_H_INCLUDED 5 | #define VPF_H_INCLUDED 6 | 7 | +#include 8 | + 9 | struct vpf_fh; 10 | 11 | struct vpf_fh *VPF_Open(const char *path, mode_t mode, pid_t *pidptr); 12 | -------------------------------------------------------------------------------- /4.1/alpine3.8/varnish-4.1.3_fix_Werror_el6.patch: -------------------------------------------------------------------------------- 1 | --- ./configure.orig 2016-08-02 14:56:14.888475820 +0200 2 | +++ ./configure 2016-08-02 14:56:26.633158063 +0200 3 | @@ -17247,7 +17247,7 @@ 4 | # The reason for -Wno-error=unused-result is a glibc/gcc interaction 5 | # idiocy where write is marked as warn_unused_result, causing build 6 | # failures. 7 | -CFLAGS="${CFLAGS} -Wall -Werror" 8 | +#CFLAGS="${CFLAGS} -Wall -Werror" 9 | OCFLAGS="${OCFLAGS} -Wall -Werror" 10 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=unused-result" >&5 11 | $as_echo_n "checking whether C compiler accepts -Werror=unused-result... " >&6; } 12 | -------------------------------------------------------------------------------- /4.1/stretch/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:stretch-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r varnish; \ 12 | for user in varnish vcache; do \ 13 | useradd -r -g varnish $user; \ 14 | done 15 | 16 | # prevent Debian's Varnish packages from being installed 17 | RUN set -eux; \ 18 | { \ 19 | echo 'Package: varnish*'; \ 20 | echo 'Pin: release *'; \ 21 | echo 'Pin-Priority: -1'; \ 22 | } > /etc/apt/preferences.d/no-debian-varnish 23 | 24 | # dependencies required for building VMOD (Varnish modules) 25 | ENV VMOD_BUILD_DEPS \ 26 | autoconf-archive \ 27 | automake \ 28 | autotools-dev \ 29 | libtool \ 30 | make \ 31 | pkg-config \ 32 | python3 33 | 34 | # persistent / runtime deps 35 | RUN apt-get update && apt-get install -y \ 36 | gcc \ 37 | libc6-dev \ 38 | --no-install-recommends && rm -r /var/lib/apt/lists/* 39 | 40 | ENV VARNISH_VERSION 4.1.11 41 | ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-4.1.11.tgz 42 | ENV VARNISH_SHA256 f937a45116f3a7fbb38b2b5d7137658a4846409630bb9eccdbbb240e1a1379bc 43 | 44 | RUN set -eux; \ 45 | \ 46 | fetchDeps=' \ 47 | ca-certificates \ 48 | wget \ 49 | '; \ 50 | buildDeps=" \ 51 | $VMOD_BUILD_DEPS \ 52 | dpkg-dev \ 53 | libedit-dev \ 54 | libjemalloc-dev \ 55 | libncurses5-dev \ 56 | libpcre3-dev \ 57 | "; \ 58 | savedAptMark="$(apt-mark showmanual)"; \ 59 | apt-get update; \ 60 | apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ 61 | rm -rf /var/lib/apt/lists/*; \ 62 | \ 63 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 64 | \ 65 | if [ -n "$VARNISH_SHA256" ]; then \ 66 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 67 | fi; \ 68 | \ 69 | mkdir -p /usr/src/varnish; \ 70 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 71 | rm varnish.tar.gz; \ 72 | \ 73 | cd /usr/src/varnish; \ 74 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 75 | ./autogen.sh; \ 76 | ./configure \ 77 | --build="$gnuArch" \ 78 | --with-rst2man=$(command -v true) \ 79 | --with-sphinx-build=$(command -v true) \ 80 | ; \ 81 | make -j "$(nproc)"; \ 82 | make install; \ 83 | ldconfig; \ 84 | \ 85 | cd /; \ 86 | rm -r /usr/src/varnish; \ 87 | \ 88 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 89 | apt-mark auto '.*' > /dev/null; \ 90 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 91 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 92 | | awk '/=>/ { print $(NF-1) }' \ 93 | | sort -u \ 94 | | xargs -r dpkg-query --search \ 95 | | cut -d: -f1 \ 96 | | sort -u \ 97 | | xargs -r apt-mark manual \ 98 | ; \ 99 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 100 | \ 101 | varnishd -V 102 | 103 | WORKDIR /usr/local/var/varnish 104 | RUN chown -R varnish:varnish /usr/local/var/varnish 105 | VOLUME /usr/local/var/varnish 106 | 107 | COPY docker-varnish-entrypoint /usr/local/bin/ 108 | ENTRYPOINT ["docker-varnish-entrypoint"] 109 | 110 | EXPOSE 80 111 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 112 | -------------------------------------------------------------------------------- /4.1/stretch/docker-varnish-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- varnishd "$@" 7 | fi 8 | 9 | # allow the container to be started with `--user` 10 | if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then 11 | chown -R varnish:varnish . 12 | fi 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /6.0/alpine3.8/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.8 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | addgroup -S varnish; \ 12 | for user in varnish vcache; do \ 13 | adduser -S -G varnish $user; \ 14 | done 15 | 16 | # dependencies required for building VMOD (Varnish modules) 17 | ENV VMOD_BUILD_DEPS \ 18 | autoconf \ 19 | # autoconf-archive \ 20 | automake \ 21 | libtool \ 22 | make \ 23 | pkgconf \ 24 | python3 25 | 26 | # persistent / runtime deps 27 | RUN apk add --no-cache --virtual .persistent-deps \ 28 | gcc \ 29 | libc-dev \ 30 | libgcc 31 | 32 | ENV VARNISH_VERSION 6.0.3 33 | ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.0.3.tgz 34 | ENV VARNISH_SHA256 4e0a4803b54726630719a22e79a2c5b36876506497e24fb39a47e9df219778d7 35 | 36 | COPY *.patch /varnish-alpine-patches/ 37 | 38 | RUN set -eux; \ 39 | \ 40 | fetchDeps=' \ 41 | ca-certificates \ 42 | wget \ 43 | '; \ 44 | buildDeps=" \ 45 | $VMOD_BUILD_DEPS \ 46 | coreutils \ 47 | dpkg \ 48 | dpkg-dev \ 49 | libedit-dev \ 50 | libexecinfo-dev \ 51 | linux-headers \ 52 | ncurses-dev \ 53 | patch \ 54 | pcre-dev \ 55 | "; \ 56 | apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ 57 | \ 58 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 59 | \ 60 | if [ -n "$VARNISH_SHA256" ]; then \ 61 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 62 | fi; \ 63 | \ 64 | mkdir -p /usr/src/varnish; \ 65 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 66 | rm varnish.tar.gz; \ 67 | \ 68 | cd /usr/src/varnish; \ 69 | for p in /varnish-alpine-patches/*.patch; do \ 70 | [ -f "$p" ] || continue; \ 71 | patch -p1 -i "$p"; \ 72 | done; \ 73 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 74 | ./autogen.sh; \ 75 | ./configure \ 76 | --build="$gnuArch" \ 77 | --without-jemalloc \ 78 | --with-rst2man=$(command -v true) \ 79 | --with-sphinx-build=$(command -v true) \ 80 | ; \ 81 | make -j "$(nproc)"; \ 82 | make install; \ 83 | \ 84 | cd /; \ 85 | rm -r /usr/src/varnish; \ 86 | \ 87 | runDeps="$( \ 88 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 89 | | tr ',' '\n' \ 90 | | sort -u \ 91 | | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 92 | )"; \ 93 | apk add --no-cache --virtual .varnish-rundeps $runDeps; \ 94 | \ 95 | apk del .build-deps; \ 96 | \ 97 | varnishd -V 98 | 99 | WORKDIR /usr/local/var/varnish 100 | RUN chown -R varnish:varnish /usr/local/var/varnish 101 | VOLUME /usr/local/var/varnish 102 | 103 | COPY docker-varnish-entrypoint /usr/local/bin/ 104 | ENTRYPOINT ["docker-varnish-entrypoint"] 105 | 106 | EXPOSE 80 107 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 108 | -------------------------------------------------------------------------------- /6.0/alpine3.8/docker-varnish-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- varnishd "$@" 7 | fi 8 | 9 | # allow the container to be started with `--user` 10 | if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then 11 | chown -R varnish:varnish . 12 | fi 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /6.0/alpine3.8/musl-include-vpf.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/vpf.h b/include/vpf.h 2 | index 822f2d3..61e2ee1 100644 3 | --- a/include/vpf.h 4 | +++ b/include/vpf.h 5 | @@ -27,6 +27,10 @@ 6 | * $FreeBSD: src/lib/libutil/libutil.h,v 1.41 2005/08/24 17:21:38 pjd Exp $ 7 | */ 8 | 9 | +#ifdef HAVE_SYS_STAT_H 10 | +# include 11 | +#endif 12 | + 13 | #ifndef VPF_H_INCLUDED 14 | #define VPF_H_INCLUDED 15 | 16 | -------------------------------------------------------------------------------- /6.0/alpine3.8/musl-include-vsb.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/vsb.h b/include/vsb.h 2 | index d510884..d9820bf 100644 3 | --- a/include/vsb.h 4 | +++ b/include/vsb.h 5 | @@ -28,6 +28,10 @@ 6 | * $FreeBSD: head/sys/sys/vsb.h 221993 2011-05-16 16:18:40Z phk $ 7 | */ 8 | 9 | +#ifdef HAVE_SYS_TYPES_H 10 | +# include 11 | +#endif 12 | + 13 | #ifndef VSB_H_INCLUDED 14 | #define VSB_H_INCLUDED 15 | 16 | -------------------------------------------------------------------------------- /6.0/stretch/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:stretch-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r varnish; \ 12 | for user in varnish vcache; do \ 13 | useradd -r -g varnish $user; \ 14 | done 15 | 16 | # prevent Debian's Varnish packages from being installed 17 | RUN set -eux; \ 18 | { \ 19 | echo 'Package: varnish*'; \ 20 | echo 'Pin: release *'; \ 21 | echo 'Pin-Priority: -1'; \ 22 | } > /etc/apt/preferences.d/no-debian-varnish 23 | 24 | # dependencies required for building VMOD (Varnish modules) 25 | ENV VMOD_BUILD_DEPS \ 26 | autoconf-archive \ 27 | automake \ 28 | autotools-dev \ 29 | libtool \ 30 | make \ 31 | pkg-config \ 32 | python3 33 | 34 | # persistent / runtime deps 35 | RUN apt-get update && apt-get install -y \ 36 | gcc \ 37 | libc6-dev \ 38 | --no-install-recommends && rm -r /var/lib/apt/lists/* 39 | 40 | ENV VARNISH_VERSION 6.0.3 41 | ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.0.3.tgz 42 | ENV VARNISH_SHA256 4e0a4803b54726630719a22e79a2c5b36876506497e24fb39a47e9df219778d7 43 | 44 | RUN set -eux; \ 45 | \ 46 | fetchDeps=' \ 47 | ca-certificates \ 48 | wget \ 49 | '; \ 50 | buildDeps=" \ 51 | $VMOD_BUILD_DEPS \ 52 | dpkg-dev \ 53 | libedit-dev \ 54 | libjemalloc-dev \ 55 | libncurses5-dev \ 56 | libpcre3-dev \ 57 | "; \ 58 | savedAptMark="$(apt-mark showmanual)"; \ 59 | apt-get update; \ 60 | apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ 61 | rm -rf /var/lib/apt/lists/*; \ 62 | \ 63 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 64 | \ 65 | if [ -n "$VARNISH_SHA256" ]; then \ 66 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 67 | fi; \ 68 | \ 69 | mkdir -p /usr/src/varnish; \ 70 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 71 | rm varnish.tar.gz; \ 72 | \ 73 | cd /usr/src/varnish; \ 74 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 75 | ./autogen.sh; \ 76 | ./configure \ 77 | --build="$gnuArch" \ 78 | --with-rst2man=$(command -v true) \ 79 | --with-sphinx-build=$(command -v true) \ 80 | ; \ 81 | make -j "$(nproc)"; \ 82 | make install; \ 83 | ldconfig; \ 84 | \ 85 | cd /; \ 86 | rm -r /usr/src/varnish; \ 87 | \ 88 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 89 | apt-mark auto '.*' > /dev/null; \ 90 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 91 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 92 | | awk '/=>/ { print $(NF-1) }' \ 93 | | sort -u \ 94 | | xargs -r dpkg-query --search \ 95 | | cut -d: -f1 \ 96 | | sort -u \ 97 | | xargs -r apt-mark manual \ 98 | ; \ 99 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 100 | \ 101 | varnishd -V 102 | 103 | WORKDIR /usr/local/var/varnish 104 | RUN chown -R varnish:varnish /usr/local/var/varnish 105 | VOLUME /usr/local/var/varnish 106 | 107 | COPY docker-varnish-entrypoint /usr/local/bin/ 108 | ENTRYPOINT ["docker-varnish-entrypoint"] 109 | 110 | EXPOSE 80 111 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 112 | -------------------------------------------------------------------------------- /6.0/stretch/docker-varnish-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- varnishd "$@" 7 | fi 8 | 9 | # allow the container to be started with `--user` 10 | if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then 11 | chown -R varnish:varnish . 12 | fi 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /6.2/alpine3.8/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.8 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | addgroup -S varnish; \ 12 | for user in varnish vcache; do \ 13 | adduser -S -G varnish $user; \ 14 | done 15 | 16 | # dependencies required for building VMOD (Varnish modules) 17 | ENV VMOD_BUILD_DEPS \ 18 | autoconf \ 19 | # autoconf-archive \ 20 | automake \ 21 | libtool \ 22 | make \ 23 | pkgconf \ 24 | python3 25 | 26 | # persistent / runtime deps 27 | RUN apk add --no-cache --virtual .persistent-deps \ 28 | gcc \ 29 | libc-dev \ 30 | libgcc 31 | 32 | ENV VARNISH_VERSION 6.2.0 33 | ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.2.0.tgz 34 | ENV VARNISH_SHA256 c37af353aca25a83d22f9c5ce0ae800fe433e4d02e1457e02886a5849f988e53 35 | 36 | COPY *.patch /varnish-alpine-patches/ 37 | 38 | RUN set -eux; \ 39 | \ 40 | fetchDeps=' \ 41 | ca-certificates \ 42 | wget \ 43 | '; \ 44 | buildDeps=" \ 45 | $VMOD_BUILD_DEPS \ 46 | coreutils \ 47 | dpkg \ 48 | dpkg-dev \ 49 | libedit-dev \ 50 | libexecinfo-dev \ 51 | linux-headers \ 52 | ncurses-dev \ 53 | patch \ 54 | pcre-dev \ 55 | "; \ 56 | apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ 57 | \ 58 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 59 | \ 60 | if [ -n "$VARNISH_SHA256" ]; then \ 61 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 62 | fi; \ 63 | \ 64 | mkdir -p /usr/src/varnish; \ 65 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 66 | rm varnish.tar.gz; \ 67 | \ 68 | cd /usr/src/varnish; \ 69 | for p in /varnish-alpine-patches/*.patch; do \ 70 | [ -f "$p" ] || continue; \ 71 | patch -p1 -i "$p"; \ 72 | done; \ 73 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 74 | ./autogen.sh; \ 75 | ./configure \ 76 | --build="$gnuArch" \ 77 | --without-jemalloc \ 78 | --with-rst2man=$(command -v true) \ 79 | --with-sphinx-build=$(command -v true) \ 80 | ; \ 81 | make -j "$(nproc)"; \ 82 | make install; \ 83 | \ 84 | cd /; \ 85 | rm -r /usr/src/varnish; \ 86 | \ 87 | runDeps="$( \ 88 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 89 | | tr ',' '\n' \ 90 | | sort -u \ 91 | | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 92 | )"; \ 93 | apk add --no-cache --virtual .varnish-rundeps $runDeps; \ 94 | \ 95 | apk del .build-deps; \ 96 | \ 97 | varnishd -V 98 | 99 | WORKDIR /usr/local/var/varnish 100 | RUN chown -R varnish:varnish /usr/local/var/varnish 101 | VOLUME /usr/local/var/varnish 102 | 103 | COPY docker-varnish-entrypoint /usr/local/bin/ 104 | ENTRYPOINT ["docker-varnish-entrypoint"] 105 | 106 | EXPOSE 80 107 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 108 | -------------------------------------------------------------------------------- /6.2/alpine3.8/docker-varnish-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- varnishd "$@" 7 | fi 8 | 9 | # allow the container to be started with `--user` 10 | if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then 11 | chown -R varnish:varnish . 12 | fi 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /6.2/alpine3.8/musl-include-vpf.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/vpf.h b/include/vpf.h 2 | index 822f2d3..61e2ee1 100644 3 | --- a/include/vpf.h 4 | +++ b/include/vpf.h 5 | @@ -27,6 +27,10 @@ 6 | * $FreeBSD: src/lib/libutil/libutil.h,v 1.41 2005/08/24 17:21:38 pjd Exp $ 7 | */ 8 | 9 | +#ifdef HAVE_SYS_STAT_H 10 | +# include 11 | +#endif 12 | + 13 | #ifndef VPF_H_INCLUDED 14 | #define VPF_H_INCLUDED 15 | 16 | -------------------------------------------------------------------------------- /6.2/alpine3.8/musl-include-vsb.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/vsb.h b/include/vsb.h 2 | index d510884..d9820bf 100644 3 | --- a/include/vsb.h 4 | +++ b/include/vsb.h 5 | @@ -28,6 +28,10 @@ 6 | * $FreeBSD: head/sys/sys/vsb.h 221993 2011-05-16 16:18:40Z phk $ 7 | */ 8 | 9 | +#ifdef HAVE_SYS_TYPES_H 10 | +# include 11 | +#endif 12 | + 13 | #ifndef VSB_H_INCLUDED 14 | #define VSB_H_INCLUDED 15 | 16 | -------------------------------------------------------------------------------- /6.2/stretch/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM debian:stretch-slim 8 | 9 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 10 | RUN set -eux; \ 11 | groupadd -r varnish; \ 12 | for user in varnish vcache; do \ 13 | useradd -r -g varnish $user; \ 14 | done 15 | 16 | # prevent Debian's Varnish packages from being installed 17 | RUN set -eux; \ 18 | { \ 19 | echo 'Package: varnish*'; \ 20 | echo 'Pin: release *'; \ 21 | echo 'Pin-Priority: -1'; \ 22 | } > /etc/apt/preferences.d/no-debian-varnish 23 | 24 | # dependencies required for building VMOD (Varnish modules) 25 | ENV VMOD_BUILD_DEPS \ 26 | autoconf-archive \ 27 | automake \ 28 | autotools-dev \ 29 | libtool \ 30 | make \ 31 | pkg-config \ 32 | python3 33 | 34 | # persistent / runtime deps 35 | RUN apt-get update && apt-get install -y \ 36 | gcc \ 37 | libc6-dev \ 38 | --no-install-recommends && rm -r /var/lib/apt/lists/* 39 | 40 | ENV VARNISH_VERSION 6.2.0 41 | ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.2.0.tgz 42 | ENV VARNISH_SHA256 c37af353aca25a83d22f9c5ce0ae800fe433e4d02e1457e02886a5849f988e53 43 | 44 | RUN set -eux; \ 45 | \ 46 | fetchDeps=' \ 47 | ca-certificates \ 48 | wget \ 49 | '; \ 50 | buildDeps=" \ 51 | $VMOD_BUILD_DEPS \ 52 | dpkg-dev \ 53 | libedit-dev \ 54 | libjemalloc-dev \ 55 | libncurses5-dev \ 56 | libpcre3-dev \ 57 | "; \ 58 | savedAptMark="$(apt-mark showmanual)"; \ 59 | apt-get update; \ 60 | apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ 61 | rm -rf /var/lib/apt/lists/*; \ 62 | \ 63 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 64 | \ 65 | if [ -n "$VARNISH_SHA256" ]; then \ 66 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 67 | fi; \ 68 | \ 69 | mkdir -p /usr/src/varnish; \ 70 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 71 | rm varnish.tar.gz; \ 72 | \ 73 | cd /usr/src/varnish; \ 74 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 75 | ./autogen.sh; \ 76 | ./configure \ 77 | --build="$gnuArch" \ 78 | --with-rst2man=$(command -v true) \ 79 | --with-sphinx-build=$(command -v true) \ 80 | ; \ 81 | make -j "$(nproc)"; \ 82 | make install; \ 83 | ldconfig; \ 84 | \ 85 | cd /; \ 86 | rm -r /usr/src/varnish; \ 87 | \ 88 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 89 | apt-mark auto '.*' > /dev/null; \ 90 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 91 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 92 | | awk '/=>/ { print $(NF-1) }' \ 93 | | sort -u \ 94 | | xargs -r dpkg-query --search \ 95 | | cut -d: -f1 \ 96 | | sort -u \ 97 | | xargs -r apt-mark manual \ 98 | ; \ 99 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 100 | \ 101 | varnishd -V 102 | 103 | WORKDIR /usr/local/var/varnish 104 | RUN chown -R varnish:varnish /usr/local/var/varnish 105 | VOLUME /usr/local/var/varnish 106 | 107 | COPY docker-varnish-entrypoint /usr/local/bin/ 108 | ENTRYPOINT ["docker-varnish-entrypoint"] 109 | 110 | EXPOSE 80 111 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 112 | -------------------------------------------------------------------------------- /6.2/stretch/docker-varnish-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- varnishd "$@" 7 | fi 8 | 9 | # allow the container to be started with `--user` 10 | if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then 11 | chown -R varnish:varnish . 12 | fi 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Creators & Maintainers 2 | 3 | Year | Organization 4 | -- | -- 5 | 2018–current | Les-Tilleuls.coop ([@coopTilleuls](https://github.com/coopTilleuls)) 6 | 2016–2017 | Tripviss ([@tripviss](https://github.com/tripviss)) 7 | 2015–2016 | The New York Times Company ([@newsdev](https://github.com/newsdev)) 8 | 9 | # All contributors 10 | 11 | https://github.com/coopTilleuls/docker-varnish/graphs/contributors 12 | -------------------------------------------------------------------------------- /Dockerfile-alpine.template: -------------------------------------------------------------------------------- 1 | FROM alpine:%%ALPINE_VERSION%% 2 | 3 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 4 | RUN set -eux; \ 5 | addgroup -S varnish; \ 6 | for user in varnish vcache; do \ 7 | adduser -S -G varnish $user; \ 8 | done 9 | 10 | # dependencies required for building VMOD (Varnish modules) 11 | ENV VMOD_BUILD_DEPS \ 12 | autoconf \ 13 | # autoconf-archive \ 14 | automake \ 15 | libtool \ 16 | make \ 17 | pkgconf \ 18 | python3 19 | 20 | # persistent / runtime deps 21 | RUN apk add --no-cache --virtual .persistent-deps \ 22 | gcc \ 23 | libc-dev \ 24 | libgcc 25 | 26 | ENV VARNISH_VERSION %%VARNISH_VERSION%% 27 | ENV VARNISH_URL %%VARNISH_URL%% 28 | ENV VARNISH_SHA256 %%VARNISH_SHA256%% 29 | 30 | COPY *.patch /varnish-alpine-patches/ 31 | 32 | RUN set -eux; \ 33 | \ 34 | fetchDeps=' \ 35 | ca-certificates \ 36 | wget \ 37 | '; \ 38 | buildDeps=" \ 39 | $VMOD_BUILD_DEPS \ 40 | coreutils \ 41 | dpkg \ 42 | dpkg-dev \ 43 | libedit-dev \ 44 | libexecinfo-dev \ 45 | linux-headers \ 46 | ncurses-dev \ 47 | patch \ 48 | pcre-dev \ 49 | "; \ 50 | apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ 51 | \ 52 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 53 | \ 54 | if [ -n "$VARNISH_SHA256" ]; then \ 55 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 56 | fi; \ 57 | \ 58 | mkdir -p /usr/src/varnish; \ 59 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 60 | rm varnish.tar.gz; \ 61 | \ 62 | cd /usr/src/varnish; \ 63 | for p in /varnish-alpine-patches/*.patch; do \ 64 | [ -f "$p" ] || continue; \ 65 | patch -p1 -i "$p"; \ 66 | done; \ 67 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 68 | ./autogen.sh; \ 69 | ./configure \ 70 | --build="$gnuArch" \ 71 | --without-jemalloc \ 72 | --with-rst2man=$(command -v true) \ 73 | --with-sphinx-build=$(command -v true) \ 74 | ; \ 75 | make -j "$(nproc)"; \ 76 | make install; \ 77 | \ 78 | cd /; \ 79 | rm -r /usr/src/varnish; \ 80 | \ 81 | runDeps="$( \ 82 | scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ 83 | | tr ',' '\n' \ 84 | | sort -u \ 85 | | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ 86 | )"; \ 87 | apk add --no-cache --virtual .varnish-rundeps $runDeps; \ 88 | \ 89 | apk del .build-deps; \ 90 | \ 91 | varnishd -V 92 | 93 | WORKDIR /usr/local/var/varnish 94 | RUN chown -R varnish:varnish /usr/local/var/varnish 95 | VOLUME /usr/local/var/varnish 96 | 97 | COPY docker-varnish-entrypoint /usr/local/bin/ 98 | ENTRYPOINT ["docker-varnish-entrypoint"] 99 | 100 | EXPOSE 80 101 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 102 | -------------------------------------------------------------------------------- /Dockerfile-debian.template: -------------------------------------------------------------------------------- 1 | FROM debian:%%DEBIAN_SUITE%% 2 | 3 | # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added 4 | RUN set -eux; \ 5 | groupadd -r varnish; \ 6 | for user in varnish vcache; do \ 7 | useradd -r -g varnish $user; \ 8 | done 9 | 10 | # prevent Debian's Varnish packages from being installed 11 | RUN set -eux; \ 12 | { \ 13 | echo 'Package: varnish*'; \ 14 | echo 'Pin: release *'; \ 15 | echo 'Pin-Priority: -1'; \ 16 | } > /etc/apt/preferences.d/no-debian-varnish 17 | 18 | # dependencies required for building VMOD (Varnish modules) 19 | ENV VMOD_BUILD_DEPS \ 20 | autoconf-archive \ 21 | automake \ 22 | autotools-dev \ 23 | libtool \ 24 | make \ 25 | pkg-config \ 26 | python3 27 | 28 | # persistent / runtime deps 29 | RUN apt-get update && apt-get install -y \ 30 | gcc \ 31 | libc6-dev \ 32 | --no-install-recommends && rm -r /var/lib/apt/lists/* 33 | 34 | ENV VARNISH_VERSION %%VARNISH_VERSION%% 35 | ENV VARNISH_URL %%VARNISH_URL%% 36 | ENV VARNISH_SHA256 %%VARNISH_SHA256%% 37 | 38 | RUN set -eux; \ 39 | \ 40 | fetchDeps=' \ 41 | ca-certificates \ 42 | wget \ 43 | '; \ 44 | buildDeps=" \ 45 | $VMOD_BUILD_DEPS \ 46 | dpkg-dev \ 47 | libedit-dev \ 48 | libjemalloc-dev \ 49 | libncurses5-dev \ 50 | libpcre3-dev \ 51 | "; \ 52 | savedAptMark="$(apt-mark showmanual)"; \ 53 | apt-get update; \ 54 | apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ 55 | rm -rf /var/lib/apt/lists/*; \ 56 | \ 57 | wget -O varnish.tar.gz "$VARNISH_URL"; \ 58 | \ 59 | if [ -n "$VARNISH_SHA256" ]; then \ 60 | echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ 61 | fi; \ 62 | \ 63 | mkdir -p /usr/src/varnish; \ 64 | tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ 65 | rm varnish.tar.gz; \ 66 | \ 67 | cd /usr/src/varnish; \ 68 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 69 | ./autogen.sh; \ 70 | ./configure \ 71 | --build="$gnuArch" \ 72 | --with-rst2man=$(command -v true) \ 73 | --with-sphinx-build=$(command -v true) \ 74 | ; \ 75 | make -j "$(nproc)"; \ 76 | make install; \ 77 | ldconfig; \ 78 | \ 79 | cd /; \ 80 | rm -r /usr/src/varnish; \ 81 | \ 82 | # reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies 83 | apt-mark auto '.*' > /dev/null; \ 84 | [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ 85 | find /usr/local -type f -executable -exec ldd '{}' ';' \ 86 | | awk '/=>/ { print $(NF-1) }' \ 87 | | sort -u \ 88 | | xargs -r dpkg-query --search \ 89 | | cut -d: -f1 \ 90 | | sort -u \ 91 | | xargs -r apt-mark manual \ 92 | ; \ 93 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ 94 | \ 95 | varnishd -V 96 | 97 | WORKDIR /usr/local/var/varnish 98 | RUN chown -R varnish:varnish /usr/local/var/varnish 99 | VOLUME /usr/local/var/varnish 100 | 101 | COPY docker-varnish-entrypoint /usr/local/bin/ 102 | ENTRYPOINT ["docker-varnish-entrypoint"] 103 | 104 | EXPOSE 80 105 | CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] 106 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2015 Docker Varnish Authors (see AUTHORS.md) 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README-short.txt: -------------------------------------------------------------------------------- 1 | Varnish is an HTTP accelerator designed for content-heavy dynamic web sites as well as APIs. 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # Supported tags and respective `Dockerfile` links 18 | 19 | - [`6.2.0-stretch`, `6.2-stretch`, `6-stretch`, `stretch`, `6.2.0`, `6.2`, `6`, `latest` (*6.2/stretch/Dockerfile*)](https://github.com/coopTilleuls/docker-varnish/blob/bdb37c46dcc3c4563b698adf2cca8722432b0913/6.2/stretch/Dockerfile) 20 | - [`6.2.0-alpine3.8`, `6.2-alpine3.8`, `6-alpine3.8`, `alpine3.8`, `6.2.0-alpine`, `6.2-alpine`, `6-alpine`, `alpine` (*6.2/alpine3.8/Dockerfile*)](https://github.com/coopTilleuls/docker-varnish/blob/bdb37c46dcc3c4563b698adf2cca8722432b0913/6.2/alpine3.8/Dockerfile) 21 | - [`6.0.3-stretch`, `6.0-stretch`, `6-lts-stretch`, `lts-stretch`, `6.0.3`, `6.0`, `6-lts`, `lts` (*6.0/stretch/Dockerfile*)](https://github.com/coopTilleuls/docker-varnish/blob/bdb37c46dcc3c4563b698adf2cca8722432b0913/6.0/stretch/Dockerfile) 22 | - [`6.0.3-alpine3.8`, `6.0-alpine3.8`, `6-lts-alpine3.8`, `lts-alpine3.8`, `6.0.3-alpine`, `6.0-alpine`, `6-lts-alpine`, `lts-alpine` (*6.0/alpine3.8/Dockerfile*)](https://github.com/coopTilleuls/docker-varnish/blob/bdb37c46dcc3c4563b698adf2cca8722432b0913/6.0/alpine3.8/Dockerfile) 23 | - [`4.1.11-stretch`, `4.1-stretch`, `4-stretch`, `4-lts-stretch`, `4.1.11`, `4.1`, `4`, `4-lts` (*4.1/stretch/Dockerfile*)](https://github.com/coopTilleuls/docker-varnish/blob/bdb37c46dcc3c4563b698adf2cca8722432b0913/4.1/stretch/Dockerfile) 24 | - [`4.1.11-alpine3.8`, `4.1-alpine3.8`, `4-alpine3.8`, `4-lts-alpine3.8`, `4.1.11-alpine`, `4.1-alpine`, `4-alpine`, `4-lts-alpine` (*4.1/alpine3.8/Dockerfile*)](https://github.com/coopTilleuls/docker-varnish/blob/bdb37c46dcc3c4563b698adf2cca8722432b0913/4.1/alpine3.8/Dockerfile) 25 | 26 | # Quick reference 27 | 28 | 30 | 31 | - **Where to file issues**: 32 | [https://github.com/coopTilleuls/docker-varnish/issues](https://github.com/coopTilleuls/docker-varnish/issues) 33 | 34 | - **Maintained by**: 35 | [the Varnish Docker Community](https://github.com/coopTilleuls/docker-varnish) 36 | 37 | 50 | 51 | - **Supported Docker versions**: 52 | [the latest release](https://github.com/docker/docker-ce/releases/latest) (down to 1.6 on a best-effort basis) 53 | 54 | # What is Varnish? 55 | 56 | Varnish is an HTTP accelerator designed for content-heavy dynamic web sites as well as APIs. In contrast to other web accelerators, such as Squid, which began life as a client-side cache, or Apache and nginx, which are primarily origin servers, Varnish was designed as an HTTP accelerator. Varnish is focused exclusively on HTTP, unlike other proxy servers that often support FTP, SMTP and other network protocols. 57 | 58 | > [wikipedia.org/wiki/Varnish_(software)](https://en.wikipedia.org/wiki/Varnish_(software)) 59 | 60 | ![logo](https://raw.githubusercontent.com/docker-library/docs/5ca8e315af01e76381d499a2928f7f47a6787f49/varnish/logo.png) 61 | 62 | # How to use this image. 63 | 64 | ## Basic usage 65 | 66 | Create a `default.vcl` file: 67 | 68 | ```vcl 69 | vcl 4.0; 70 | 71 | backend default { 72 | .host = "www.nytimes.com"; 73 | .port = "80"; 74 | } 75 | ``` 76 | 77 | Then run: 78 | 79 | ```console 80 | $ docker run --name my-running-varnish -v /path/to/default.vcl:/usr/local/etc/varnish/default.vcl:ro --tmpfs /usr/local/var/varnish:exec -d cooptilleuls/varnish 81 | ``` 82 | 83 | Alternatively, a simple `Dockerfile` can be used to generate a new image that includes the necessary `default.vcl` (which is a much cleaner solution than the bind mount above): 84 | 85 | ```dockerfile 86 | FROM cooptilleuls/varnish:6.2 87 | 88 | COPY default.vcl /usr/local/etc/varnish/ 89 | ``` 90 | 91 | Place this file in the same directory as your `default.vcl`, run `docker build -t my-varnish .`, then start your container: 92 | 93 | ```console 94 | $ docker run --name my-running-varnish --tmpfs /usr/local/var/varnish:exec -d my-varnish 95 | ``` 96 | 97 | ### Exposing the port 98 | 99 | ```console 100 | $ docker run --name my-running-varnish --tmpfs /usr/local/var/varnish:exec -d -p 8080:80 my-varnish 101 | ``` 102 | 103 | Then you can hit `http://localhost:8080` or `http://host-ip:8080` in your browser. 104 | 105 | # How to install VMODs (Varnish Modules) 106 | 107 | [VMODs](https://varnish-cache.org/vmods/) are extensions written for Varnish Cache. 108 | 109 | Install VMODs in your Varnish project's `Dockerfile`. For example, to install the [vmod-querystring](https://github.com/Dridi/libvmod-querystring) module: 110 | 111 | ```dockerfile 112 | FROM cooptilleuls/varnish:6.2 113 | 114 | # install vmod-querystring 115 | ENV VMOD_QUERYSTRING_VERSION 1.0.5 116 | RUN set -eux; \ 117 | \ 118 | fetchDeps=' \ 119 | ca-certificates \ 120 | wget \ 121 | '; \ 122 | buildDeps=" \ 123 | $VMOD_BUILD_DEPS \ 124 | dpkg-dev \ 125 | "; \ 126 | apt-get update; \ 127 | apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ 128 | rm -rf /var/lib/apt/lists/*; \ 129 | \ 130 | wget -O vmod-querystring.tar.gz "https://github.com/Dridi/libvmod-querystring/releases/download/v$VMOD_QUERYSTRING_VERSION/vmod-querystring-$VMOD_QUERYSTRING_VERSION.tar.gz"; \ 131 | mkdir -p /usr/local/src/vmod-querystring; \ 132 | tar -zxf vmod-querystring.tar.gz -C /usr/local/src/vmod-querystring --strip-components=1; \ 133 | rm vmod-querystring.tar.gz; \ 134 | \ 135 | cd /usr/local/src/vmod-querystring; \ 136 | gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ 137 | ./configure \ 138 | --build="$gnuArch" \ 139 | ; \ 140 | make -j "$(nproc)"; \ 141 | make install; \ 142 | \ 143 | cd /; \ 144 | rm -rf /usr/local/src/vmod-querystring; \ 145 | \ 146 | apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps $buildDeps 147 | ``` 148 | 149 | # Image Variants 150 | 151 | The `cooptilleuls/varnish` images come in many flavors, each designed for a specific use case. 152 | 153 | ## `cooptilleuls/varnish:` 154 | 155 | This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of. 156 | 157 | Some of these tags may have names like stretch in them. These are the suite code names for releases of [Debian](https://wiki.debian.org/DebianReleases) and indicate which release the image is based on. 158 | 159 | ## `cooptilleuls/varnish:-alpine` 160 | 161 | This image is based on the popular [Alpine Linux project](http://alpinelinux.org), available in [the `alpine` official image](https://hub.docker.com/_/alpine). Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general. 162 | 163 | This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use [musl libc](http://www.musl-libc.org) instead of [glibc and friends](http://www.etalabs.net/compare_libcs.html), so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See [this Hacker News comment thread](https://news.ycombinator.com/item?id=10782897) for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images. 164 | 165 | To minimize image size, it's uncommon for additional related tools (such as `git` or `bash`) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the [`alpine` image description](https://hub.docker.com/_/alpine/) for examples of how to install packages if you are unfamiliar). 166 | 167 | # License 168 | 169 | View [license information](https://github.com/varnishcache/varnish-cache/blob/master/LICENSE) for the software contained in this image. 170 | 171 | As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained). 172 | 173 | 174 | 175 | As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within. 176 | -------------------------------------------------------------------------------- /docker-varnish-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- varnishd "$@" 7 | fi 8 | 9 | # allow the container to be started with `--user` 10 | if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then 11 | chown -R varnish:varnish . 12 | fi 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -Eeuo pipefail 3 | 4 | declare -A aliases=( 5 | [4.1]='4 4-lts' 6 | [6.0]='6-lts lts' 7 | [6.2]='6 latest' 8 | ) 9 | 10 | defaultDebianSuite='stretch' 11 | defaultAlpineVersion='3.8' 12 | 13 | self="$(basename "$BASH_SOURCE")" 14 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 15 | 16 | versions=( */ ) 17 | versions=( "${versions[@]%/}" ) 18 | 19 | # sort version numbers with highest first 20 | IFS=$'\n'; versions=( $(echo "${versions[*]}" | sort -rV) ); unset IFS 21 | 22 | # get the most recent commit which modified any of "$@" 23 | fileCommit() { 24 | git log -1 --format='format:%H' HEAD -- "$@" 25 | } 26 | 27 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 28 | dirCommit() { 29 | local dir="$1"; shift 30 | local copyPaths; 31 | ( 32 | cd "$dir" 33 | IFS=" " read -r -a copyPaths <<< "$(git show HEAD:./Dockerfile | awk ' 34 | BEGIN { ORS=" "; } 35 | toupper($1) == "COPY" { 36 | for (i = 2; i < NF; i++) { 37 | print $i 38 | } 39 | } 40 | ')" 41 | fileCommit Dockerfile "${copyPaths[@]}" 42 | ) 43 | } 44 | 45 | getArches() { 46 | local repo="$1"; shift 47 | local officialImagesUrl='https://github.com/docker-library/official-images/raw/master/library/' 48 | 49 | eval "declare -g -A parentRepoToArches=( $( 50 | find -name 'Dockerfile' -exec awk ' 51 | toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|microsoft\/[^:]+)(:|$)/ { 52 | print "'"$officialImagesUrl"'" $2 53 | } 54 | ' '{}' + \ 55 | | sort -u \ 56 | | xargs bashbrew cat --format '[{{ .RepoName }}:{{ .TagName }}]="{{ join " " .TagEntry.Architectures }}"' 57 | ) )" 58 | } 59 | getArches 'varnish' 60 | 61 | cat <<-EOH 62 | # this file is generated via https://github.com/coopTilleuls/docker-varnish/blob/$(fileCommit "$self")/$self 63 | 64 | Maintainers: Teoh Han Hui (@teohhanhui) 65 | GitRepo: https://github.com/coopTilleuls/docker-varnish.git 66 | EOH 67 | 68 | # prints "$2$1$3$1...$N" 69 | join() { 70 | local sep="$1"; shift 71 | local out; printf -v out "${sep//%/%%}%s" "$@" 72 | echo "${out#$sep}" 73 | } 74 | 75 | for version in "${versions[@]}"; do 76 | versionAliases=( 77 | $version 78 | ${aliases[$version]:-} 79 | ) 80 | 81 | # order here controls the order of the library/ file 82 | for variant in \ 83 | stretch \ 84 | alpine3.8 \ 85 | ; do 86 | dir="$version/$variant" 87 | [ -f "$dir/Dockerfile" ] || continue 88 | 89 | commit="$(dirCommit "$dir")" 90 | fullVersion="$(git show "$commit":"$dir/Dockerfile" | awk '$1 == "ENV" && $2 == "VARNISH_VERSION" { print $3; exit }')" 91 | 92 | baseAliases=( $fullVersion "${versionAliases[@]}" ) 93 | variantAliases=( "${baseAliases[@]/%/-$variant}" ) 94 | variantAliases=( "${variantAliases[@]//latest-/}" ) 95 | 96 | variantAliases+=( "${baseAliases[@]}" ) 97 | 98 | if [ "${variant#alpine}" = "$defaultAlpineVersion" ]; then 99 | variantAliases=( "${variantAliases[@]/%/-alpine}" ) 100 | variantAliases=( "${variantAliases[@]/%${variant}-alpine/$variant}" ) 101 | elif [ "$variant" != "$defaultDebianSuite" ]; then 102 | variantAliases=() 103 | fi 104 | variantAliases=( "${variantAliases[@]//latest-/}" ) 105 | 106 | variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")" 107 | variantArches="${parentRepoToArches[$variantParent]}" 108 | 109 | echo 110 | cat <<-EOE 111 | Tags: $(join ', ' "${variantAliases[@]}") 112 | Architectures: $(join ', ' $variantArches) 113 | GitCommit: $commit 114 | Directory: $dir 115 | EOE 116 | done 117 | done 118 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | versions=( "$@" ) 7 | if [ ${#versions[@]} -eq 0 ]; then 8 | versions=( */ ) 9 | fi 10 | versions=( "${versions[@]%/}" ) 11 | 12 | generated_warning() { 13 | cat <<-EOH 14 | # 15 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 16 | # 17 | # PLEASE DO NOT EDIT IT DIRECTLY. 18 | # 19 | 20 | EOH 21 | } 22 | 23 | travisEnv= 24 | for version in "${versions[@]}"; do 25 | possibles=( $( 26 | { 27 | git ls-remote --tags https://github.com/varnishcache/varnish-cache.git "refs/tags/varnish-${version}.*" \ 28 | | sed -r 's!^.*refs/tags/varnish-([0-9a-z.]+).*$!\1!' \ 29 | || : 30 | } | sort -ruV 31 | ) ) 32 | 33 | fullVersion= 34 | if [ "${#possibles[@]}" -gt 0 ]; then 35 | fullVersion="${possibles[0]}" 36 | fi 37 | 38 | if [ -z "$fullVersion" ]; then 39 | echo >&2 40 | echo >&2 "error: unable to determine available releases of $version" 41 | echo >&2 42 | exit 1 43 | fi 44 | 45 | url='https://varnish-cache.org/_downloads/varnish-'"$fullVersion"'.tgz' 46 | sha256=$(wget -qO- -o /dev/null "$url" | sha256sum - | awk '{print $1}') 47 | 48 | dockerfiles=() 49 | 50 | for variant in stretch alpine3.8; do 51 | [ -d "$version/$variant" ] || continue 52 | alpineVer="${variant#alpine}" 53 | 54 | baseDockerfile=Dockerfile-debian.template 55 | if [ "${variant#alpine}" != "$variant" ]; then 56 | baseDockerfile=Dockerfile-alpine.template 57 | fi 58 | 59 | { generated_warning; cat "$baseDockerfile"; } > "$version/$variant/Dockerfile" 60 | 61 | echo "Generating $version/$variant/Dockerfile from $baseDockerfile" 62 | 63 | cp -a \ 64 | docker-varnish-entrypoint \ 65 | "$version/$variant/" 66 | 67 | sed -ri \ 68 | -e 's!%%DEBIAN_SUITE%%!'"$variant"'-slim!' \ 69 | -e 's!%%ALPINE_VERSION%%!'"$alpineVer"'!' \ 70 | "$version/$variant/Dockerfile" 71 | dockerfiles+=( "$version/$variant/Dockerfile" ) 72 | done 73 | 74 | ( 75 | set -x 76 | sed -ri \ 77 | -e 's!%%VARNISH_VERSION%%!'"$fullVersion"'!' \ 78 | -e 's!%%VARNISH_URL%%!'"$url"'!' \ 79 | -e 's!%%VARNISH_SHA256%%!'"$sha256"'!' \ 80 | "${dockerfiles[@]}" 81 | ) 82 | 83 | newTravisEnv= 84 | for dockerfile in "${dockerfiles[@]}"; do 85 | dir="${dockerfile%Dockerfile}" 86 | dir="${dir%/}" 87 | variant="${dir#$version}" 88 | variant="${variant#/}" 89 | newTravisEnv+='\n - VERSION='"$version VARIANT=$variant" 90 | done 91 | travisEnv="$newTravisEnv$travisEnv" 92 | done 93 | 94 | travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)" 95 | echo "$travis" > .travis.yml 96 | --------------------------------------------------------------------------------