Browse Source

Delete fewer things

master
dave 5 years ago
parent
commit
9067c90e29
  1. 10
      Dockerfile
  2. 8
      README.md
  3. 20
      start

10
Dockerfile

@ -1,16 +1,18 @@
FROM ubuntu:trusty
RUN locale-gen en_US en_US.UTF-8 ;\
ADD start /start
RUN chmod +x /start ;\
locale-gen en_US en_US.UTF-8 ;\
apt-get update ;\
apt-get install -y apt-transport-https curl ;\
curl https://repo.varnish-cache.org/ubuntu/GPG-key.txt | apt-key add - ;\
echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list ;\
apt-get update ;\
DEBIAN_FRONTEND=noninteractive apt-get install -y varnish ;\
echo '00000000-0000-0000-0000-000000000000' > /etc/varnish/secret
DEBIAN_FRONTEND=noninteractive apt-get install -y varnish
WORKDIR /etc/varnish
ENTRYPOINT ["/usr/sbin/varnishd", "-f", "/etc/varnish/default.vcl", "-a", "0.0.0.0:80", "-T", "0.0.0.0:6082", "-S", "/etc/varnish/secret", "-F"]
ENTRYPOINT ["/start"]
EXPOSE 80 6082

8
README.md

@ -10,14 +10,10 @@ Container for running [Varnish Cache](https://www.varnish-cache.org/).
*Advanced*
* Set memory size - append: `-s malloc,256M`
* Set a secret - mount `-v /path/to/file/containg/uuid:/etc/varnish/secret`
* Set memory size: `-e MEMSIZE=64M`
* Set a secret: `-e SECRET=00000000-0000-0000-0000-000000000000`
* Expose control terminal: `-p 1234:6082`
*Extras*
* test.vcl - example default.vcl file
*Notes*
The default secret is `00000000-0000-0000-0000-000000000000`. This is INSECURE if you decide to expose the varnish control terminal.

20
start

@ -0,0 +1,20 @@
#!/bin/sh
# Set default varnish memory cache size if not specified
if [ -z "$MEMSIZE" ]; then
export MEMSIZE=64M
fi
# Set varnish secret if not specified
if [ ! -f /etc/varnish/secret ]; then
if [ -z "$SECRET" ]; then
SECRET=`cat /proc/sys/kernel/random/uuid`
fi
echo $SECRET > /etc/varnish/secret
fi
echo "Secret is `cat /etc/varnish/secret`"
# Check vcl syntax
varnishd -C -f /etc/varnish/default.vcl > /dev/null || exit 1
exec /usr/sbin/varnishd -f /etc/varnish/default.vcl -a 0.0.0.0:80 -T 0.0.0.0:6082 -S /etc/varnish/secret -F -s malloc,${MEMSIZE} $@
Loading…
Cancel
Save