From cc0825b06dab75f6e311e970aeeddbea8484d033 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Wed, 8 Feb 2017 10:07:59 +0300 Subject: [PATCH] squid container --- Dockerfile | 13 +++++++++++++ README.md | 4 +++- docker-entrypoint.sh | 15 +++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..72ee5a1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM alpine +MAINTAINER b4tman + +ENV SQUID_CONFIG_FILE=/etc/squid/squid.conf +RUN apk add --no-cache squid + +VOLUME ["/var/cache/squid"] + +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] +CMD ["squid"] + +EXPOSE 3128/tcp diff --git a/README.md b/README.md index 01fd83d..36bc266 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # docker-squid -ocker Squid container based on Alpine + +Docker Squid container based on Alpine Linux + diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000..2b68ea6 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +if [ "$1" = 'squid' ]; then + mkdir -p /var/log/squid + mkdir -p /var/cache/squid + + if [ ! "$(ls -A /var/cache/squid)" ]; then + /usr/sbin/squid -f ${SQUID_CONFIG_FILE} -z + fi + + exec /usr/sbin/squid -f ${SQUID_CONFIG_FILE} -NYCd 1 +else + exec "$@" +fi