Use jinja2 for building nginx config

master
kaiyou 7 years ago
parent 87cbeacecd
commit 1854349ecc

@ -0,0 +1,9 @@
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
COPY conf /conf
COPY start.sh /start.sh
CMD /start.sh

@ -0,0 +1,61 @@
# Basic configuration
user nginx;
worker_processes 1;
error_log /dev/stderr info;
pid /var/run/nginx.pid;
load_module "modules/ngx_mail_module.so";
events {
worker_connections 1024;
}
http {
# Standard HTTP configuration with slight hardening
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /dev/stdout;
sendfile on;
keepalive_timeout 65;
server_tokens off;
server {
listen 80;
# Actual logic
location / {
return 301 $scheme://$host/webmail/;
}
location /webmail {
proxy_pass http://webmail;
}
location /admin {
proxy_pass http://admin;
}
location /webdav {
proxy_pass http://webdav:5232;
}
}
}
mail {
server_name test.mailu.io;
auth_http http://172.18.0.1:5000/nginx;
proxy_pass_error_message on;
server {
listen 25;
protocol smtp;
smtp_auth plain;
}
server {
listen 143;
protocol imap;
imap_auth plain;
}
}

@ -0,0 +1,5 @@
#!/bin/sh
jinja2 /conf/nginx.conf > /etc/nginx/nginx.conf
exec nginx -g 'daemon off;'
Loading…
Cancel
Save