Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to the official Varnish Docker images #35

Merged
merged 2 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ env:
- REPO=docksal/varnish

matrix:
- VERSION=4.1 TAGS=4.1
- VERSION=6.0 TAGS=6.0
- VERSION=6.1 TAGS=6.1,latest
- VERSION=6.2 TAGS=6.2,latest

install:
# Install Docksal to have a matching versions of Docker on the build host
Expand Down
43 changes: 9 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
FROM alpine:3.9
ARG VERSION
FROM varnish:${VERSION}

ARG VERSION
ENV VERSION=${VERSION}

RUN set -ex; \
apk add --update --no-cache \
bash \
su-exec \
supervisor \
;\
case ${VERSION} in \
6.1) alpinever="3.9";; \
6.0) alpinever="3.8";; \
5.2) alpinever="3.7";; \
4.1) alpinever="3.6";; \
esac; \
mv /etc/apk/repositories /etc/apk/repositories.orig; \
echo "http://dl-cdn.alpinelinux.org/alpine/v${alpinever}/main" >/etc/apk/repositories; \
echo "http://dl-cdn.alpinelinux.org/alpine/v${alpinever}/community" >>/etc/apk/repositories; \
apk add --update --no-cache varnish; \
mv -f /etc/apk/repositories.orig /etc/apk/repositories; \
rm -rf /var/cache/apk/*

# Install aditional dependencies
ARG GOMPLATE_VERSION=3.0.0
RUN set -xe; \
apk add --no-cache -t .fetch-deps \
curl \
; \
# gomplate - go templates in configs
curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gomplate; \
chmod +x /usr/local/bin/gomplate; \
\
apk del --purge .fetch-deps; \
rm -rf /var/cache/apk/*
RUN set -x && \
apt-get update && \
apt-get install -y --no-install-recommends curl net-tools && \
rm -rf /var/lib/apt/lists/* && \
curl -o /usr/local/bin/gomplate -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim && \
chmod 755 /usr/local/bin/gomplate

# Override the main supervisord config file, since some parameters are not overridable via an include
# See https://github.com/Supervisor/supervisor/issues/962
COPY conf/supervisord.conf /etc/supervisord.conf
COPY conf/default.vcl.tmpl /etc/varnish/default.vcl.tmpl
COPY docker-entrypoint.d /etc/docker-entrypoint.d/
COPY bin /usr/local/bin/
Expand All @@ -57,7 +32,7 @@ EXPOSE 80
EXPOSE 6082

ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["docker-cmd.sh"]
CMD ["varnishd.sh"]

# Health check script
HEALTHCHECK --interval=5s --timeout=1s --retries=12 CMD ["docker-healthcheck.sh"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DOCKER ?= docker

VERSION ?= 6.1
VERSION ?= 6.2
TAG ?= $(VERSION)

REPO ?= docksal/varnish
Expand Down
1 change: 1 addition & 0 deletions bin/varnishd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

echo 'Starting varnishd...'
exec varnishd \
-F \
-f /etc/varnish/default.vcl \
-s malloc,${VARNISH_CACHE_SIZE} \
-a :${VARNISH_PORT} \
Expand Down