From 75533b707cc3235ee1170c726598dab82c283c25 Mon Sep 17 00:00:00 2001 From: Guillaume Quintard Date: Fri, 3 May 2019 10:24:37 -0700 Subject: [PATCH] Simpler Dockerfiles - leverage the upstream packages for debian - for alpine, us the aports - simplify update.sh --- .travis.yml | 14 +- 4.1/alpine3.8/Dockerfile | 107 ------------- 4.1/alpine3.8/fix-compat-execinfo.patch | 11 -- 4.1/alpine3.8/fix-stack-overflow.patch | 44 ------ 4.1/alpine3.8/musl-mode_t.patch | 11 -- .../varnish-4.1.3_fix_Werror_el6.patch | 11 -- 4.1/stretch/Dockerfile | 111 ------------- 6.0/alpine/3.8/Dockerfile | 34 ++++ .../alpine/3.8}/docker-varnish-entrypoint | 0 6.0/alpine3.8/Dockerfile | 107 ------------- 6.0/alpine3.8/musl-include-vpf.patch | 15 -- 6.0/alpine3.8/musl-include-vsb.patch | 15 -- 6.0/debian/stretch/Dockerfile | 22 +++ .../debian}/stretch/docker-varnish-entrypoint | 0 6.0/stretch/Dockerfile | 111 ------------- 6.2/alpine/3.8/Dockerfile | 34 ++++ .../alpine/3.8}/docker-varnish-entrypoint | 0 6.2/alpine3.8/Dockerfile | 107 ------------- 6.2/alpine3.8/docker-varnish-entrypoint | 14 -- 6.2/alpine3.8/musl-include-vpf.patch | 15 -- 6.2/alpine3.8/musl-include-vsb.patch | 15 -- 6.2/debian/stretch/Dockerfile | 22 +++ .../debian}/stretch/docker-varnish-entrypoint | 0 6.2/stretch/Dockerfile | 111 ------------- 6.2/stretch/docker-varnish-entrypoint | 14 -- Dockerfile-alpine.template | 109 +++---------- Dockerfile-centos.template | 13 ++ Dockerfile-debian.template | 107 ++----------- update.sh | 148 +++++++++--------- 29 files changed, 235 insertions(+), 1087 deletions(-) delete mode 100644 4.1/alpine3.8/Dockerfile delete mode 100644 4.1/alpine3.8/fix-compat-execinfo.patch delete mode 100644 4.1/alpine3.8/fix-stack-overflow.patch delete mode 100644 4.1/alpine3.8/musl-mode_t.patch delete mode 100644 4.1/alpine3.8/varnish-4.1.3_fix_Werror_el6.patch delete mode 100644 4.1/stretch/Dockerfile create mode 100644 6.0/alpine/3.8/Dockerfile rename {4.1/alpine3.8 => 6.0/alpine/3.8}/docker-varnish-entrypoint (100%) delete mode 100644 6.0/alpine3.8/Dockerfile delete mode 100644 6.0/alpine3.8/musl-include-vpf.patch delete mode 100644 6.0/alpine3.8/musl-include-vsb.patch create mode 100644 6.0/debian/stretch/Dockerfile rename {4.1 => 6.0/debian}/stretch/docker-varnish-entrypoint (100%) delete mode 100644 6.0/stretch/Dockerfile create mode 100644 6.2/alpine/3.8/Dockerfile rename {6.0/alpine3.8 => 6.2/alpine/3.8}/docker-varnish-entrypoint (100%) delete mode 100644 6.2/alpine3.8/Dockerfile delete mode 100755 6.2/alpine3.8/docker-varnish-entrypoint delete mode 100644 6.2/alpine3.8/musl-include-vpf.patch delete mode 100644 6.2/alpine3.8/musl-include-vsb.patch create mode 100644 6.2/debian/stretch/Dockerfile rename {6.0 => 6.2/debian}/stretch/docker-varnish-entrypoint (100%) delete mode 100644 6.2/stretch/Dockerfile delete mode 100755 6.2/stretch/docker-varnish-entrypoint create mode 100644 Dockerfile-centos.template diff --git a/.travis.yml b/.travis.yml index 9bdb427..361d1c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,20 +2,18 @@ language: bash services: docker env: - - VERSION=6.2 VARIANT=stretch - - VERSION=6.2 VARIANT=alpine3.8 - - VERSION=6.0 VARIANT=stretch - - VERSION=6.0 VARIANT=alpine3.8 - - VERSION=4.1 VARIANT=stretch - - VERSION=4.1 VARIANT=alpine3.8 + - VERSION=6.0 DIST=debian REL=stretch + - VERSION=6.0 DIST=alpine REL=3.8 + - VERSION=6.2 DIST=debian REL=stretch + - VERSION=6.2 DIST=alpine REL=3.8 install: - git clone https://github.com/docker-library/official-images.git ~/official-images before_script: - env | sort - - cd "$VERSION/$VARIANT" - - image="varnish:${VERSION}-${VARIANT}" + - cd "$VERSION/${DIST}/${REL}" + - image="varnish:${VERSION}-${DIST}-${REL}" script: - travis_retry docker build -t "$image" . diff --git a/4.1/alpine3.8/Dockerfile b/4.1/alpine3.8/Dockerfile deleted file mode 100644 index b2930b7..0000000 --- a/4.1/alpine3.8/Dockerfile +++ /dev/null @@ -1,107 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.8 - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - addgroup -S varnish; \ - for user in varnish vcache; do \ - adduser -S -G varnish $user; \ - done - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf \ - # autoconf-archive \ - automake \ - libtool \ - make \ - pkgconf \ - python3 - -# persistent / runtime deps -RUN apk add --no-cache --virtual .persistent-deps \ - gcc \ - libc-dev \ - libgcc - -ENV VARNISH_VERSION 4.1.11 -ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-4.1.11.tgz -ENV VARNISH_SHA256 f937a45116f3a7fbb38b2b5d7137658a4846409630bb9eccdbbb240e1a1379bc - -COPY *.patch /varnish-alpine-patches/ - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - coreutils \ - dpkg \ - dpkg-dev \ - libedit-dev \ - libexecinfo-dev \ - linux-headers \ - ncurses-dev \ - patch \ - pcre-dev \ - "; \ - apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - for p in /varnish-alpine-patches/*.patch; do \ - [ -f "$p" ] || continue; \ - patch -p1 -i "$p"; \ - done; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --without-jemalloc \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache --virtual .varnish-rundeps $runDeps; \ - \ - apk del .build-deps; \ - \ - varnishd -V - -WORKDIR /usr/local/var/varnish -RUN chown -R varnish:varnish /usr/local/var/varnish -VOLUME /usr/local/var/varnish - -COPY docker-varnish-entrypoint /usr/local/bin/ -ENTRYPOINT ["docker-varnish-entrypoint"] - -EXPOSE 80 -CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/4.1/alpine3.8/fix-compat-execinfo.patch b/4.1/alpine3.8/fix-compat-execinfo.patch deleted file mode 100644 index e806a32..0000000 --- a/4.1/alpine3.8/fix-compat-execinfo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- varnish-4.0.2.orig/lib/libvarnishcompat/execinfo.c -+++ varnish-4.0.2/lib/libvarnishcompat/execinfo.c -@@ -30,7 +30,7 @@ - - #include "compat/execinfo.h" - --#if defined (__GNUC__) && __GNUC__ >= 4 /* XXX Correct version to check for ? */ -+#if !defined(__arm__) && defined (__GNUC__) && __GNUC__ >= 4 /* XXX Correct version to check for ? */ - - #include - #include diff --git a/4.1/alpine3.8/fix-stack-overflow.patch b/4.1/alpine3.8/fix-stack-overflow.patch deleted file mode 100644 index 23fb7cc..0000000 --- a/4.1/alpine3.8/fix-stack-overflow.patch +++ /dev/null @@ -1,44 +0,0 @@ -From f88f2ead8cc5958262d333c46e94ddc8a3c9ae18 Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Tue, 21 Nov 2017 12:10:34 +0100 -Subject: [PATCH] fix stack overflow in epoll waiter - -musl libc has a default thread stack of 80k. avoid overflow the stack by -allocating the epol_event array on heap instead of stack. ---- - bin/varnishd/waiter/cache_waiter_epoll.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/bin/varnishd/waiter/cache_waiter_epoll.c b/bin/varnishd/waiter/cache_waiter_epoll.c -index 71c426a..ccbc64c 100644 ---- a/bin/varnishd/waiter/cache_waiter_epoll.c -+++ b/bin/varnishd/waiter/cache_waiter_epoll.c -@@ -74,7 +74,7 @@ struct vwe { - static void * - vwe_thread(void *priv) - { -- struct epoll_event ev[NEEV], *ep; -+ struct epoll_event *ev, *ep; - struct waited *wp; - struct waiter *w; - double now, then; -@@ -87,6 +87,8 @@ vwe_thread(void *priv) - CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); - THR_SetName("cache-epoll"); - THR_Init(); -+ ev = malloc(NEEV * sizeof(struct epoll_event)); -+ assert(ev != NULL); - - now = VTIM_real(); - while (1) { -@@ -154,6 +156,7 @@ vwe_thread(void *priv) - AZ(close(vwe->pipe[0])); - AZ(close(vwe->pipe[1])); - AZ(close(vwe->epfd)); -+ free(ev); - return (NULL); - } - --- -2.13.5 - diff --git a/4.1/alpine3.8/musl-mode_t.patch b/4.1/alpine3.8/musl-mode_t.patch deleted file mode 100644 index d69ca92..0000000 --- a/4.1/alpine3.8/musl-mode_t.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./include/vpf.h.orig -+++ ./include/vpf.h -@@ -30,6 +30,8 @@ - #ifndef VPF_H_INCLUDED - #define VPF_H_INCLUDED - -+#include -+ - struct vpf_fh; - - struct vpf_fh *VPF_Open(const char *path, mode_t mode, pid_t *pidptr); diff --git a/4.1/alpine3.8/varnish-4.1.3_fix_Werror_el6.patch b/4.1/alpine3.8/varnish-4.1.3_fix_Werror_el6.patch deleted file mode 100644 index 835d403..0000000 --- a/4.1/alpine3.8/varnish-4.1.3_fix_Werror_el6.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./configure.orig 2016-08-02 14:56:14.888475820 +0200 -+++ ./configure 2016-08-02 14:56:26.633158063 +0200 -@@ -17247,7 +17247,7 @@ - # The reason for -Wno-error=unused-result is a glibc/gcc interaction - # idiocy where write is marked as warn_unused_result, causing build - # failures. --CFLAGS="${CFLAGS} -Wall -Werror" -+#CFLAGS="${CFLAGS} -Wall -Werror" - OCFLAGS="${OCFLAGS} -Wall -Werror" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Werror=unused-result" >&5 - $as_echo_n "checking whether C compiler accepts -Werror=unused-result... " >&6; } diff --git a/4.1/stretch/Dockerfile b/4.1/stretch/Dockerfile deleted file mode 100644 index 5c7f78d..0000000 --- a/4.1/stretch/Dockerfile +++ /dev/null @@ -1,111 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:stretch-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - groupadd -r varnish; \ - for user in varnish vcache; do \ - useradd -r -g varnish $user; \ - done - -# prevent Debian's Varnish packages from being installed -RUN set -eux; \ - { \ - echo 'Package: varnish*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-varnish - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf-archive \ - automake \ - autotools-dev \ - libtool \ - make \ - pkg-config \ - python3 - -# persistent / runtime deps -RUN apt-get update && apt-get install -y \ - gcc \ - libc6-dev \ - --no-install-recommends && rm -r /var/lib/apt/lists/* - -ENV VARNISH_VERSION 4.1.11 -ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-4.1.11.tgz -ENV VARNISH_SHA256 f937a45116f3a7fbb38b2b5d7137658a4846409630bb9eccdbbb240e1a1379bc - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - dpkg-dev \ - libedit-dev \ - libjemalloc-dev \ - libncurses5-dev \ - libpcre3-dev \ - "; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ - rm -rf /var/lib/apt/lists/*; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - ldconfig; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - \ - varnishd -V - -WORKDIR /usr/local/var/varnish -RUN chown -R varnish:varnish /usr/local/var/varnish -VOLUME /usr/local/var/varnish - -COPY docker-varnish-entrypoint /usr/local/bin/ -ENTRYPOINT ["docker-varnish-entrypoint"] - -EXPOSE 80 -CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/6.0/alpine/3.8/Dockerfile b/6.0/alpine/3.8/Dockerfile new file mode 100644 index 0000000..d4d8727 --- /dev/null +++ b/6.0/alpine/3.8/Dockerfile @@ -0,0 +1,34 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.8 + +RUN apk add git alpine-sdk && \ + adduser -D builder && \ + addgroup builder abuild && \ + chgrp abuild /var/cache/distfiles && \ + su builder -c "abuild-keygen -na" && \ + chmod g+w /var/cache/distfiles && \ + su builder -c "git clone https://git.alpinelinux.org/aports /tmp/aports" && \ + cd /tmp/aports/main/varnish && \ + su builder -c "abuild checksum && abuild -r" && \ + apk add ~builder/packages/main/x86_64/*.apk --allow-untrusted + +WORKDIR /usr/local/var/varnish +RUN chown -R varnish:varnish /usr/local/var/varnish +VOLUME /usr/local/var/varnish + +COPY docker-varnish-entrypoint /usr/local/bin/ +ENTRYPOINT ["docker-varnish-entrypoint"] + +EXPOSE 80 +CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/4.1/alpine3.8/docker-varnish-entrypoint b/6.0/alpine/3.8/docker-varnish-entrypoint similarity index 100% rename from 4.1/alpine3.8/docker-varnish-entrypoint rename to 6.0/alpine/3.8/docker-varnish-entrypoint diff --git a/6.0/alpine3.8/Dockerfile b/6.0/alpine3.8/Dockerfile deleted file mode 100644 index 810ed2e..0000000 --- a/6.0/alpine3.8/Dockerfile +++ /dev/null @@ -1,107 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.8 - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - addgroup -S varnish; \ - for user in varnish vcache; do \ - adduser -S -G varnish $user; \ - done - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf \ - # autoconf-archive \ - automake \ - libtool \ - make \ - pkgconf \ - python3 - -# persistent / runtime deps -RUN apk add --no-cache --virtual .persistent-deps \ - gcc \ - libc-dev \ - libgcc - -ENV VARNISH_VERSION 6.0.3 -ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.0.3.tgz -ENV VARNISH_SHA256 4e0a4803b54726630719a22e79a2c5b36876506497e24fb39a47e9df219778d7 - -COPY *.patch /varnish-alpine-patches/ - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - coreutils \ - dpkg \ - dpkg-dev \ - libedit-dev \ - libexecinfo-dev \ - linux-headers \ - ncurses-dev \ - patch \ - pcre-dev \ - "; \ - apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - for p in /varnish-alpine-patches/*.patch; do \ - [ -f "$p" ] || continue; \ - patch -p1 -i "$p"; \ - done; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --without-jemalloc \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache --virtual .varnish-rundeps $runDeps; \ - \ - apk del .build-deps; \ - \ - varnishd -V - -WORKDIR /usr/local/var/varnish -RUN chown -R varnish:varnish /usr/local/var/varnish -VOLUME /usr/local/var/varnish - -COPY docker-varnish-entrypoint /usr/local/bin/ -ENTRYPOINT ["docker-varnish-entrypoint"] - -EXPOSE 80 -CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/6.0/alpine3.8/musl-include-vpf.patch b/6.0/alpine3.8/musl-include-vpf.patch deleted file mode 100644 index 04e86c2..0000000 --- a/6.0/alpine3.8/musl-include-vpf.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/include/vpf.h b/include/vpf.h -index 822f2d3..61e2ee1 100644 ---- a/include/vpf.h -+++ b/include/vpf.h -@@ -27,6 +27,10 @@ - * $FreeBSD: src/lib/libutil/libutil.h,v 1.41 2005/08/24 17:21:38 pjd Exp $ - */ - -+#ifdef HAVE_SYS_STAT_H -+# include -+#endif -+ - #ifndef VPF_H_INCLUDED - #define VPF_H_INCLUDED - diff --git a/6.0/alpine3.8/musl-include-vsb.patch b/6.0/alpine3.8/musl-include-vsb.patch deleted file mode 100644 index 41e4f5a..0000000 --- a/6.0/alpine3.8/musl-include-vsb.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/include/vsb.h b/include/vsb.h -index d510884..d9820bf 100644 ---- a/include/vsb.h -+++ b/include/vsb.h -@@ -28,6 +28,10 @@ - * $FreeBSD: head/sys/sys/vsb.h 221993 2011-05-16 16:18:40Z phk $ - */ - -+#ifdef HAVE_SYS_TYPES_H -+# include -+#endif -+ - #ifndef VSB_H_INCLUDED - #define VSB_H_INCLUDED - diff --git a/6.0/debian/stretch/Dockerfile b/6.0/debian/stretch/Dockerfile new file mode 100644 index 0000000..c3dda55 --- /dev/null +++ b/6.0/debian/stretch/Dockerfile @@ -0,0 +1,22 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:stretch-slim + +RUN apt-get update && \ + apt-get install -y curl && \ + curl -s https://packagecloud.io/install/repositories/varnishcache/varnish60lts/script.deb.sh | bash && \ + apt-get update && \ + apt-get install -y varnish && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /etc/varnish + +COPY docker-varnish-entrypoint /usr/local/bin/ +ENTRYPOINT ["docker-varnish-entrypoint"] + +EXPOSE 80 +CMD ["varnishd", "-F", "-f", "/etc/varnish/default.vcl"] diff --git a/4.1/stretch/docker-varnish-entrypoint b/6.0/debian/stretch/docker-varnish-entrypoint similarity index 100% rename from 4.1/stretch/docker-varnish-entrypoint rename to 6.0/debian/stretch/docker-varnish-entrypoint diff --git a/6.0/stretch/Dockerfile b/6.0/stretch/Dockerfile deleted file mode 100644 index 79cd680..0000000 --- a/6.0/stretch/Dockerfile +++ /dev/null @@ -1,111 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:stretch-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - groupadd -r varnish; \ - for user in varnish vcache; do \ - useradd -r -g varnish $user; \ - done - -# prevent Debian's Varnish packages from being installed -RUN set -eux; \ - { \ - echo 'Package: varnish*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-varnish - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf-archive \ - automake \ - autotools-dev \ - libtool \ - make \ - pkg-config \ - python3 - -# persistent / runtime deps -RUN apt-get update && apt-get install -y \ - gcc \ - libc6-dev \ - --no-install-recommends && rm -r /var/lib/apt/lists/* - -ENV VARNISH_VERSION 6.0.3 -ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.0.3.tgz -ENV VARNISH_SHA256 4e0a4803b54726630719a22e79a2c5b36876506497e24fb39a47e9df219778d7 - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - dpkg-dev \ - libedit-dev \ - libjemalloc-dev \ - libncurses5-dev \ - libpcre3-dev \ - "; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ - rm -rf /var/lib/apt/lists/*; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - ldconfig; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - \ - varnishd -V - -WORKDIR /usr/local/var/varnish -RUN chown -R varnish:varnish /usr/local/var/varnish -VOLUME /usr/local/var/varnish - -COPY docker-varnish-entrypoint /usr/local/bin/ -ENTRYPOINT ["docker-varnish-entrypoint"] - -EXPOSE 80 -CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/6.2/alpine/3.8/Dockerfile b/6.2/alpine/3.8/Dockerfile new file mode 100644 index 0000000..d4d8727 --- /dev/null +++ b/6.2/alpine/3.8/Dockerfile @@ -0,0 +1,34 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.8 + +RUN apk add git alpine-sdk && \ + adduser -D builder && \ + addgroup builder abuild && \ + chgrp abuild /var/cache/distfiles && \ + su builder -c "abuild-keygen -na" && \ + chmod g+w /var/cache/distfiles && \ + su builder -c "git clone https://git.alpinelinux.org/aports /tmp/aports" && \ + cd /tmp/aports/main/varnish && \ + su builder -c "abuild checksum && abuild -r" && \ + apk add ~builder/packages/main/x86_64/*.apk --allow-untrusted + +WORKDIR /usr/local/var/varnish +RUN chown -R varnish:varnish /usr/local/var/varnish +VOLUME /usr/local/var/varnish + +COPY docker-varnish-entrypoint /usr/local/bin/ +ENTRYPOINT ["docker-varnish-entrypoint"] + +EXPOSE 80 +CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/6.0/alpine3.8/docker-varnish-entrypoint b/6.2/alpine/3.8/docker-varnish-entrypoint similarity index 100% rename from 6.0/alpine3.8/docker-varnish-entrypoint rename to 6.2/alpine/3.8/docker-varnish-entrypoint diff --git a/6.2/alpine3.8/Dockerfile b/6.2/alpine3.8/Dockerfile deleted file mode 100644 index add98ec..0000000 --- a/6.2/alpine3.8/Dockerfile +++ /dev/null @@ -1,107 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM alpine:3.8 - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - addgroup -S varnish; \ - for user in varnish vcache; do \ - adduser -S -G varnish $user; \ - done - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf \ - # autoconf-archive \ - automake \ - libtool \ - make \ - pkgconf \ - python3 - -# persistent / runtime deps -RUN apk add --no-cache --virtual .persistent-deps \ - gcc \ - libc-dev \ - libgcc - -ENV VARNISH_VERSION 6.2.0 -ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.2.0.tgz -ENV VARNISH_SHA256 c37af353aca25a83d22f9c5ce0ae800fe433e4d02e1457e02886a5849f988e53 - -COPY *.patch /varnish-alpine-patches/ - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - coreutils \ - dpkg \ - dpkg-dev \ - libedit-dev \ - libexecinfo-dev \ - linux-headers \ - ncurses-dev \ - patch \ - pcre-dev \ - "; \ - apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - for p in /varnish-alpine-patches/*.patch; do \ - [ -f "$p" ] || continue; \ - patch -p1 -i "$p"; \ - done; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --without-jemalloc \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache --virtual .varnish-rundeps $runDeps; \ - \ - apk del .build-deps; \ - \ - varnishd -V - -WORKDIR /usr/local/var/varnish -RUN chown -R varnish:varnish /usr/local/var/varnish -VOLUME /usr/local/var/varnish - -COPY docker-varnish-entrypoint /usr/local/bin/ -ENTRYPOINT ["docker-varnish-entrypoint"] - -EXPOSE 80 -CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/6.2/alpine3.8/docker-varnish-entrypoint b/6.2/alpine3.8/docker-varnish-entrypoint deleted file mode 100755 index 536ef1a..0000000 --- a/6.2/alpine3.8/docker-varnish-entrypoint +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- varnishd "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then - chown -R varnish:varnish . -fi - -exec "$@" diff --git a/6.2/alpine3.8/musl-include-vpf.patch b/6.2/alpine3.8/musl-include-vpf.patch deleted file mode 100644 index 04e86c2..0000000 --- a/6.2/alpine3.8/musl-include-vpf.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/include/vpf.h b/include/vpf.h -index 822f2d3..61e2ee1 100644 ---- a/include/vpf.h -+++ b/include/vpf.h -@@ -27,6 +27,10 @@ - * $FreeBSD: src/lib/libutil/libutil.h,v 1.41 2005/08/24 17:21:38 pjd Exp $ - */ - -+#ifdef HAVE_SYS_STAT_H -+# include -+#endif -+ - #ifndef VPF_H_INCLUDED - #define VPF_H_INCLUDED - diff --git a/6.2/alpine3.8/musl-include-vsb.patch b/6.2/alpine3.8/musl-include-vsb.patch deleted file mode 100644 index 41e4f5a..0000000 --- a/6.2/alpine3.8/musl-include-vsb.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/include/vsb.h b/include/vsb.h -index d510884..d9820bf 100644 ---- a/include/vsb.h -+++ b/include/vsb.h -@@ -28,6 +28,10 @@ - * $FreeBSD: head/sys/sys/vsb.h 221993 2011-05-16 16:18:40Z phk $ - */ - -+#ifdef HAVE_SYS_TYPES_H -+# include -+#endif -+ - #ifndef VSB_H_INCLUDED - #define VSB_H_INCLUDED - diff --git a/6.2/debian/stretch/Dockerfile b/6.2/debian/stretch/Dockerfile new file mode 100644 index 0000000..2b6277f --- /dev/null +++ b/6.2/debian/stretch/Dockerfile @@ -0,0 +1,22 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:stretch-slim + +RUN apt-get update && \ + apt-get install -y curl && \ + curl -s https://packagecloud.io/install/repositories/varnishcache/varnish62/script.deb.sh | bash && \ + apt-get update && \ + apt-get install -y varnish && \ + rm -rf /var/lib/apt/lists/* + +WORKDIR /etc/varnish + +COPY docker-varnish-entrypoint /usr/local/bin/ +ENTRYPOINT ["docker-varnish-entrypoint"] + +EXPOSE 80 +CMD ["varnishd", "-F", "-f", "/etc/varnish/default.vcl"] diff --git a/6.0/stretch/docker-varnish-entrypoint b/6.2/debian/stretch/docker-varnish-entrypoint similarity index 100% rename from 6.0/stretch/docker-varnish-entrypoint rename to 6.2/debian/stretch/docker-varnish-entrypoint diff --git a/6.2/stretch/Dockerfile b/6.2/stretch/Dockerfile deleted file mode 100644 index c43f415..0000000 --- a/6.2/stretch/Dockerfile +++ /dev/null @@ -1,111 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" -# -# PLEASE DO NOT EDIT IT DIRECTLY. -# - -FROM debian:stretch-slim - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - groupadd -r varnish; \ - for user in varnish vcache; do \ - useradd -r -g varnish $user; \ - done - -# prevent Debian's Varnish packages from being installed -RUN set -eux; \ - { \ - echo 'Package: varnish*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-varnish - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf-archive \ - automake \ - autotools-dev \ - libtool \ - make \ - pkg-config \ - python3 - -# persistent / runtime deps -RUN apt-get update && apt-get install -y \ - gcc \ - libc6-dev \ - --no-install-recommends && rm -r /var/lib/apt/lists/* - -ENV VARNISH_VERSION 6.2.0 -ENV VARNISH_URL https://varnish-cache.org/_downloads/varnish-6.2.0.tgz -ENV VARNISH_SHA256 c37af353aca25a83d22f9c5ce0ae800fe433e4d02e1457e02886a5849f988e53 - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - dpkg-dev \ - libedit-dev \ - libjemalloc-dev \ - libncurses5-dev \ - libpcre3-dev \ - "; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ - rm -rf /var/lib/apt/lists/*; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - ldconfig; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - \ - varnishd -V - -WORKDIR /usr/local/var/varnish -RUN chown -R varnish:varnish /usr/local/var/varnish -VOLUME /usr/local/var/varnish - -COPY docker-varnish-entrypoint /usr/local/bin/ -ENTRYPOINT ["docker-varnish-entrypoint"] - -EXPOSE 80 -CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] diff --git a/6.2/stretch/docker-varnish-entrypoint b/6.2/stretch/docker-varnish-entrypoint deleted file mode 100755 index 536ef1a..0000000 --- a/6.2/stretch/docker-varnish-entrypoint +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -e - -# first arg is `-f` or `--some-option` -if [ "${1#-}" != "$1" ]; then - set -- varnishd "$@" -fi - -# allow the container to be started with `--user` -if [ "$1" = 'varnishd' ] && [ "$(id -u)" = '0' ]; then - chown -R varnish:varnish . -fi - -exec "$@" diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index e346b59..e2546bc 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -1,94 +1,21 @@ -FROM alpine:%%ALPINE_VERSION%% - -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - addgroup -S varnish; \ - for user in varnish vcache; do \ - adduser -S -G varnish $user; \ - done - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf \ - # autoconf-archive \ - automake \ - libtool \ - make \ - pkgconf \ - python3 - -# persistent / runtime deps -RUN apk add --no-cache --virtual .persistent-deps \ - gcc \ - libc-dev \ - libgcc - -ENV VARNISH_VERSION %%VARNISH_VERSION%% -ENV VARNISH_URL %%VARNISH_URL%% -ENV VARNISH_SHA256 %%VARNISH_SHA256%% - -COPY *.patch /varnish-alpine-patches/ - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - coreutils \ - dpkg \ - dpkg-dev \ - libedit-dev \ - libexecinfo-dev \ - linux-headers \ - ncurses-dev \ - patch \ - pcre-dev \ - "; \ - apk add --no-cache --virtual .build-deps $fetchDeps $buildDeps; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - for p in /varnish-alpine-patches/*.patch; do \ - [ -f "$p" ] || continue; \ - patch -p1 -i "$p"; \ - done; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --without-jemalloc \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ - runDeps="$( \ - scanelf --needed --nobanner --format '%n#p' --recursive /usr/local \ - | tr ',' '\n' \ - | sort -u \ - | awk 'system("[ -e /usr/local/lib/" $1 " ] || [ -e /usr/local/lib/varnish/" $1 " ]") == 0 { next } { print "so:" $1 }' \ - )"; \ - apk add --no-cache --virtual .varnish-rundeps $runDeps; \ - \ - apk del .build-deps; \ - \ - varnishd -V +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.8 + +RUN apk add git alpine-sdk && \ + adduser -D builder && \ + addgroup builder abuild && \ + chgrp abuild /var/cache/distfiles && \ + su builder -c "abuild-keygen -na" && \ + chmod g+w /var/cache/distfiles && \ + su builder -c "git clone https://git.alpinelinux.org/aports /tmp/aports" && \ + cd /tmp/aports/main/varnish && \ + su builder -c "abuild checksum && abuild -r" && \ + apk add ~builder/packages/main/x86_64/*.apk --allow-untrusted WORKDIR /usr/local/var/varnish RUN chown -R varnish:varnish /usr/local/var/varnish diff --git a/Dockerfile-centos.template b/Dockerfile-centos.template new file mode 100644 index 0000000..0b3b0d8 --- /dev/null +++ b/Dockerfile-centos.template @@ -0,0 +1,13 @@ +FROM %%DISTRIBUTION%%:%%RELEASE%% + +RUN curl -s https://packagecloud.io/install/repositories/varnishcache/varnish%%VARNISH_VERSION%%/script.rpm.sh | bash && \ + yum install epel-release -y && \ + yum install -y varnish + +WORKDIR /etc/varnish + +COPY docker-varnish-entrypoint /usr/local/bin/ +ENTRYPOINT ["docker-varnish-entrypoint"] + +EXPOSE 80 +CMD ["varnishd", "-F", "-f", "/etc/varnish/default.vcl"] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index d36c466..da0e928 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -1,105 +1,16 @@ -FROM debian:%%DEBIAN_SUITE%% +FROM %%DISTRIBUTION%%:%%RELEASE%% -# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added -RUN set -eux; \ - groupadd -r varnish; \ - for user in varnish vcache; do \ - useradd -r -g varnish $user; \ - done +RUN apt-get update && \ + apt-get install -y curl && \ + curl -s https://packagecloud.io/install/repositories/varnishcache/varnish%%VARNISH_VERSION%%/script.deb.sh | bash && \ + apt-get update && \ + apt-get install -y varnish && \ + rm -rf /var/lib/apt/lists/* -# prevent Debian's Varnish packages from being installed -RUN set -eux; \ - { \ - echo 'Package: varnish*'; \ - echo 'Pin: release *'; \ - echo 'Pin-Priority: -1'; \ - } > /etc/apt/preferences.d/no-debian-varnish - -# dependencies required for building VMOD (Varnish modules) -ENV VMOD_BUILD_DEPS \ - autoconf-archive \ - automake \ - autotools-dev \ - libtool \ - make \ - pkg-config \ - python3 - -# persistent / runtime deps -RUN apt-get update && apt-get install -y \ - gcc \ - libc6-dev \ - --no-install-recommends && rm -r /var/lib/apt/lists/* - -ENV VARNISH_VERSION %%VARNISH_VERSION%% -ENV VARNISH_URL %%VARNISH_URL%% -ENV VARNISH_SHA256 %%VARNISH_SHA256%% - -RUN set -eux; \ - \ - fetchDeps=' \ - ca-certificates \ - wget \ - '; \ - buildDeps=" \ - $VMOD_BUILD_DEPS \ - dpkg-dev \ - libedit-dev \ - libjemalloc-dev \ - libncurses5-dev \ - libpcre3-dev \ - "; \ - savedAptMark="$(apt-mark showmanual)"; \ - apt-get update; \ - apt-get install -y --no-install-recommends $fetchDeps $buildDeps; \ - rm -rf /var/lib/apt/lists/*; \ - \ - wget -O varnish.tar.gz "$VARNISH_URL"; \ - \ - if [ -n "$VARNISH_SHA256" ]; then \ - echo "$VARNISH_SHA256 *varnish.tar.gz" | sha256sum -c -; \ - fi; \ - \ - mkdir -p /usr/src/varnish; \ - tar -zxf varnish.tar.gz -C /usr/src/varnish --strip-components=1; \ - rm varnish.tar.gz; \ - \ - cd /usr/src/varnish; \ - gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \ - ./autogen.sh; \ - ./configure \ - --build="$gnuArch" \ - --with-rst2man=$(command -v true) \ - --with-sphinx-build=$(command -v true) \ - ; \ - make -j "$(nproc)"; \ - make install; \ - ldconfig; \ - \ - cd /; \ - rm -r /usr/src/varnish; \ - \ -# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies - apt-mark auto '.*' > /dev/null; \ - [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \ - find /usr/local -type f -executable -exec ldd '{}' ';' \ - | awk '/=>/ { print $(NF-1) }' \ - | sort -u \ - | xargs -r dpkg-query --search \ - | cut -d: -f1 \ - | sort -u \ - | xargs -r apt-mark manual \ - ; \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - \ - varnishd -V - -WORKDIR /usr/local/var/varnish -RUN chown -R varnish:varnish /usr/local/var/varnish -VOLUME /usr/local/var/varnish +WORKDIR /etc/varnish COPY docker-varnish-entrypoint /usr/local/bin/ ENTRYPOINT ["docker-varnish-entrypoint"] EXPOSE 80 -CMD ["varnishd", "-F", "-f", "/usr/local/etc/varnish/default.vcl"] +CMD ["varnishd", "-F", "-f", "/etc/varnish/default.vcl"] diff --git a/update.sh b/update.sh index c04a1a6..fbf0cac 100755 --- a/update.sh +++ b/update.sh @@ -1,13 +1,21 @@ #!/bin/bash set -e -cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" +VERSIONS="6.0 6.2" +declare -A RELEASES +RELEASES[alpine]="3.8" +#RELEASES[centos]="7" +RELEASES[debian]="stretch" +#RELEASES[ubuntu]="xenial bionic" -versions=( "$@" ) -if [ ${#versions[@]} -eq 0 ]; then - versions=( */ ) -fi -versions=( "${versions[@]%/}" ) +declare -A LTS_MAP +LTS_MAP[6.0]=yes + +declare -A ALPINE_COMMITS +ALPINE_COMMITS[6.0]=d2bfb22c8e8f67ad7d8d02704f35ec4d2a19f9b9 +ALPINE_COMMITS[6.2]=a55f66b0a1dbdc03b31d48e7b49b38dccf7897fb + +cd "$(dirname "$0")" generated_warning() { cat <<-EOH @@ -21,75 +29,73 @@ generated_warning() { } travisEnv= -for version in "${versions[@]}"; do - possibles=( $( - { - git ls-remote --tags https://github.com/varnishcache/varnish-cache.git "refs/tags/varnish-${version}.*" \ - | sed -r 's!^.*refs/tags/varnish-([0-9a-z.]+).*$!\1!' \ - || : - } | sort -ruV - ) ) - - fullVersion= - if [ "${#possibles[@]}" -gt 0 ]; then - fullVersion="${possibles[0]}" - fi +vdr= - if [ -z "$fullVersion" ]; then - echo >&2 - echo >&2 "error: unable to determine available releases of $version" - echo >&2 - exit 1 +for version in $VERSIONS; do for dist in ${!RELEASES[@]}; do for rel in ${RELEASES[$dist]}; do +fullVersion= + workdir=$version/$dist/$rel + [ -d "$workdir" ] || continue + + travisEnv+=" - VERSION=$version DIST=$dist REL=$rel\n" + case $dist in + alpine) + baseDockerfile=Dockerfile-alpine.template + ;; + centos) + baseDockerfile=Dockerfile-centos.template + ;; + debian) + baseDockerfile=Dockerfile-debian.template + rel+=-slim + ;; + ubuntu) + baseDockerfile=Dockerfile-debian.template + ;; + *) + echo "Unknown distribution: $dist" + exit 1 + esac + + if [ $dist != alpine ]; then + if [ -n "${LTS_MAP[$version]}" ]; then + fullVersion=$(echo $version | tr -d '.')lts + else + fullVersion=$(echo $version | tr -d '.') + fi fi - url='https://varnish-cache.org/_downloads/varnish-'"$fullVersion"'.tgz' - sha256=$(wget -qO- -o /dev/null "$url" | sha256sum - | awk '{print $1}') + { generated_warning; cat "$baseDockerfile"; } > "$workdir/Dockerfile" - dockerfiles=() + echo "Generating $workdir/Dockerfile from $baseDockerfile" - for variant in stretch alpine3.8; do - [ -d "$version/$variant" ] || continue - alpineVer="${variant#alpine}" + cp -a \ + docker-varnish-entrypoint \ + "$workdir" - baseDockerfile=Dockerfile-debian.template - if [ "${variant#alpine}" != "$variant" ]; then - baseDockerfile=Dockerfile-alpine.template - fi + sed -ri \ + -e "s!%%DISTRIBUTION%%!$dist!" \ + -e "s!%%RELEASE%%!$rel!" \ + -e 's!%%ALPINE_COMMIT%%!'"${ALPINE_COMMITS[$version]}"'!' \ + -e 's!%%VARNISH_VERSION%%!'"$fullVersion"'!' \ + "$workdir/Dockerfile" +done; done; done + +echo -e "language: bash +services: docker + +env: +$travisEnv"' +install: + - git clone https://github.com/docker-library/official-images.git ~/official-images + +before_script: + - env | sort + - cd "$VERSION/${DIST}/${REL}" + - image="varnish:${VERSION}-${DIST}-${REL}" + +script: + - travis_retry docker build -t "$image" . + - ~/official-images/test/run.sh "$image" - { generated_warning; cat "$baseDockerfile"; } > "$version/$variant/Dockerfile" - - echo "Generating $version/$variant/Dockerfile from $baseDockerfile" - - cp -a \ - docker-varnish-entrypoint \ - "$version/$variant/" - - sed -ri \ - -e 's!%%DEBIAN_SUITE%%!'"$variant"'-slim!' \ - -e 's!%%ALPINE_VERSION%%!'"$alpineVer"'!' \ - "$version/$variant/Dockerfile" - dockerfiles+=( "$version/$variant/Dockerfile" ) - done - - ( - set -x - sed -ri \ - -e 's!%%VARNISH_VERSION%%!'"$fullVersion"'!' \ - -e 's!%%VARNISH_URL%%!'"$url"'!' \ - -e 's!%%VARNISH_SHA256%%!'"$sha256"'!' \ - "${dockerfiles[@]}" - ) - - newTravisEnv= - for dockerfile in "${dockerfiles[@]}"; do - dir="${dockerfile%Dockerfile}" - dir="${dir%/}" - variant="${dir#$version}" - variant="${variant#/}" - newTravisEnv+='\n - VERSION='"$version VARIANT=$variant" - done - travisEnv="$newTravisEnv$travisEnv" -done - -travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)" -echo "$travis" > .travis.yml +after_script: + - docker images' > .travis.yml