Prepare nginx as a unique frontend
parent
995147f444
commit
755d9f0520
@ -1,9 +1,8 @@
|
||||
FROM alpine:edge
|
||||
|
||||
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
|
||||
&& apk add --no-cache nginx nginx-mod-mail py-setuptools jinja2-cli@testing
|
||||
RUN apk add --no-cache nginx nginx-mod-mail python py-jinja2
|
||||
|
||||
COPY conf /conf
|
||||
COPY start.sh /start.sh
|
||||
COPY start.py /start.py
|
||||
|
||||
CMD /start.sh
|
||||
CMD /start.py
|
||||
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import jinja2
|
||||
import os
|
||||
import socket
|
||||
|
||||
convert = lambda src, dst: open(dst, "w").write(jinja2.Template(open(src).read()).render(**os.environ))
|
||||
|
||||
# Actual startup script
|
||||
os.environ["ADMIN_ADDRESS"] = socket.gethostbyname("admin")
|
||||
convert("/conf/nginx.conf", "/etc/nginx/nginx.conf")
|
||||
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
jinja2 /conf/nginx.conf > /etc/nginx/nginx.conf
|
||||
|
||||
exec nginx -g 'daemon off;'
|
Loading…
Reference in New Issue