From aa568967342789f5bbd7249016d38a17b048c6a2 Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Wed, 1 Nov 2023 09:04:50 +0800 Subject: [PATCH] proxy use local ips --- docker/proxy/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docker/proxy/Dockerfile b/docker/proxy/Dockerfile index 35f15388..0efc4c89 100644 --- a/docker/proxy/Dockerfile +++ b/docker/proxy/Dockerfile @@ -9,10 +9,15 @@ LABEL version="2.10.4" RUN apt-get update && apt-get install --no-install-recommends -y curl jq && rm -rf /var/lib/apt/lists/* COPY ./config/initproxy.conf /etc/ - COPY ./s6/w9init/setuser.sh /app/setuser.sh COPY ./s6/w9init/migration.sh /app/migration.sh - RUN chmod +x /app/setuser.sh /app/migration.sh +RUN export add_ip_data="const ipDataFile={[CLOUDFRONT_URL]:'ip-ranges.json',[CLOUDFARE_V4_URL]:'ips-v4',[CLOUDFARE_V6_URL]:'ips-v6'}[url];logger.info(ipDataFile);if(ipDataFile){return fs.readFile(__dirname+'/../lib/ipData/'+ipDataFile,'utf8',(error,data)=>{if(error){logger.error('fetch '+ipDataFile+' error');reject(error);return}logger.info('fetch '+ipDataFile+' success');resolve(data)})}" && \ + sed -i "s#url);#&${add_ip_data}#g" /app/internal/ip_ranges.js && \ + mkdir -p /app/lib/ipData && cd /app/lib/ipData && \ + curl -O https://ip-ranges.amazonaws.com/ip-ranges.json && \ + curl -O https://www.cloudflare.com/ips-v4 && \ + curl -O https://www.cloudflare.com/ips-v6 + CMD ["/bin/sh", "-c", "/app/migration.sh && /app/setuser.sh && tail -f /dev/null"] \ No newline at end of file