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