Update to start without working upstream
This commit is contained in:
@@ -5,7 +5,7 @@ COPY servers.json /servers.json
|
||||
COPY domains.txt /domains.txt
|
||||
COPY nginx.conf /nginx.conf
|
||||
|
||||
RUN python /add_servers.py --nginx /nginx.conf --domains_list_txt /domains.txt --servers_config_json server.json --certificates_path /ssl
|
||||
RUN python /add_servers.py --nginx /nginx.conf --domains_list_txt /domains.txt --servers_config_json servers.json --certificates_path /ssl
|
||||
|
||||
|
||||
FROM nginx:alpine
|
||||
|
||||
@@ -7,7 +7,9 @@ import sys
|
||||
REDIRECT_TEMPLATE = "\n".join(
|
||||
(
|
||||
"\tlocation / {{",
|
||||
"\t\tproxy_pass {redirection_host}/;",
|
||||
"\t\tresolver 127.0.0.11 valid=30s;",
|
||||
"\t\tset $host_{i} {redirection_host};",
|
||||
"\t\tproxy_pass $host_{i}/;",
|
||||
"\t\tinclude proxy_common.conf;",
|
||||
"\t}}",
|
||||
)
|
||||
@@ -57,7 +59,7 @@ class Server:
|
||||
if self.options is None:
|
||||
self.options = []
|
||||
|
||||
def format(self, indent: str = " ", base_indent: int = 1) -> str:
|
||||
def format(self, i: int, indent: str = " ", base_indent: int = 1) -> str:
|
||||
"""Format server to place inside nginx.conf"""
|
||||
res = (indent * base_indent) + (
|
||||
SERVER_HTTPS_TEMPLATE if self.certificate is not None else SERVER_HTTP_TEMPLATE
|
||||
@@ -67,7 +69,7 @@ class Server:
|
||||
redirection=(
|
||||
REDIRECT_TEMPLATE.replace("\n", "\n" + indent * base_indent)
|
||||
.replace("\t", indent)
|
||||
.format(redirection_host=self.redirect)
|
||||
.format(i=i, redirection_host=self.redirect)
|
||||
if self.redirect is not None
|
||||
else ""
|
||||
),
|
||||
@@ -190,7 +192,7 @@ def main() -> None:
|
||||
Server(domain, None, domain if not args.http_only else None, certificates_path=args.certificates_path)
|
||||
)
|
||||
|
||||
nginx_servers_part = "\n\n".join(server.format() for server in nginx_servers)
|
||||
nginx_servers_part = "\n\n".join(server.format(i) for i, server in enumerate(nginx_servers))
|
||||
|
||||
print(f"Using following servers part for nginx.conf:\n\n{nginx_servers_part}")
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ COPY server_common.conf /etc/nginx/server_common.conf
|
||||
COPY --from=builder /nginx.conf /etc/nginx/nginx.conf
|
||||
COPY domains.txt /domains.txt
|
||||
|
||||
RUN echo "(sleep 30 && killall nginx) &" > /entrypoint && \
|
||||
RUN echo "(sleep 60 && killall nginx) &" > /entrypoint && \
|
||||
echo "cp /domains.txt /ssl/domains.txt" >> /entrypoint && \
|
||||
echo "nginx -g 'daemon off;'" >> /entrypoint && \
|
||||
echo "nginx" >> /entrypoint
|
||||
|
||||
Reference in New Issue
Block a user