diff --git a/Dockerfile b/Dockerfile index 41da3b6..b7d0e4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ RUN mkdir -m 755 -p /data/cachedomains ;\ apt-get update ;\ apt-get install -y jq git ; +RUN git clone --depth=1 --no-single-branch https://github.com/uklans/cache-domains/ /data/cache-domains VOLUME ["/data/logs", "/data/cache", "/data/cachedomains", "/var/www"] diff --git a/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh b/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh index 54bcdfb..8bcf3ae 100644 --- a/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh +++ b/overlay/hooks/entrypoint-pre.d/15_generate_maps.sh @@ -2,16 +2,25 @@ IFS=' ' mkdir -p /data/cachedomains -cd /data/cachedomains +echo "Bootstrapping Monolithic from ${CACHE_DOMAINS_REPO}" + export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" +pushd /data/cachedomains > /dev/null if [[ ! -d .git ]]; then git clone ${CACHE_DOMAINS_REPO} . fi if [[ "${NOFETCH:-false}" != "true" ]]; then - git fetch origin + # Disable error checking whilst we attempt to get latest + set +e + git remote set-url origin ${CACHE_DOMAINS_REPO} + git fetch origin || echo "Failed to update from remote, using local copy of cache_domains" git reset --hard origin/${CACHE_DOMAINS_BRANCH} + # Reenable error checking + set -e fi +popd > /dev/null + TEMP_PATH=$(mktemp -d) OUTPUTFILE=${TEMP_PATH}/outfile.conf echo "map \"\$http_user_agent£££\$http_host\" \$cacheidentifier {" >> $OUTPUTFILE