mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-21 23:20:23 +00:00
build proxy
This commit is contained in:
parent
763248e45f
commit
5be2248e3c
2 changed files with 27 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
# modify time: 202311071641, you can modify here to trigger Docker Build action
|
||||
# modify time: 202312111034, you can modify here to trigger Docker Build action
|
||||
# from Dockerfile: https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/docker/Dockerfile
|
||||
# from image: https://hub.docker.com/r/jc21/nginx-proxy-manager
|
||||
|
||||
|
@ -11,6 +11,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y curl jq && rm -
|
|||
COPY ./config/initproxy.conf /etc/
|
||||
COPY ./s6/w9init/setuser.sh /app/setuser.sh
|
||||
COPY ./s6/w9init/migration.sh /app/migration.sh
|
||||
COPY ./s6/w9init/proxy.sh /app/proxy.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)})}" && \
|
||||
|
@ -20,4 +21,4 @@ RUN export add_ip_data="const ipDataFile={[CLOUDFRONT_URL]:'ip-ranges.json',[CLO
|
|||
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"]
|
||||
CMD ["/bin/sh", "-c", "/app/migration.sh && /app/setuser.sh && setproxy.sh && tail -f /dev/null"]
|
24
docker/proxy/s6/w9init/setproxy.sh
Normal file
24
docker/proxy/s6/w9init/setproxy.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
|
||||
set +e
|
||||
|
||||
# Define the array
|
||||
proxy_line=("proxy_set_header Upgrade \$http_upgrade;" "proxy_set_header Connection upgrade;")
|
||||
|
||||
# Define the file path
|
||||
proxy_path="/etc/nginx/conf.d/include/proxy.conf"
|
||||
|
||||
# Get the length of the array
|
||||
length=${#proxy_line[@]}
|
||||
|
||||
# Loop over the array and append each item to the file
|
||||
for ((i=0; i<$length; i++)); do
|
||||
# Check if the line already exists in the file
|
||||
if ! grep -Fxq "${proxy_line[$i]}" $proxy_path; then
|
||||
# If the line does not exist in the file, append it
|
||||
echo "${proxy_line[$i]}" >> $proxy_path
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
set -e
|
Loading…
Reference in a new issue