forked from sproutsocial/botanist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.nginx
23 lines (17 loc) · 1.1 KB
/
Dockerfile.nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM python:2.7.14 as collectstatic
ADD webapp/requirements.txt /tmp
RUN pip install -r /tmp/requirements.txt
ADD ./webapp /code
RUN /code/manage.py collectstatic --noinput
# multistage builds are awesomeeee
# https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds
FROM stantonk/nginx-ldap:1.0.1
# for envsubst
RUN apt-get update && apt-get install -y gettext
# from https://raw.githubusercontent.com/nginx/nginx/master/conf/uwsgi_params
ADD uwsgi_params /etc/nginx/uwsgi_params
ADD ./etc/nginx/nginx.conf.template /etc/nginx/nginx.conf.template
COPY --from=collectstatic /code/botanist-static /data/static
# enumrate env vars we allow envsubst to operate on so nginx variables
# such as $host and $request_uri don't get replaced :)
CMD /bin/bash -c "envsubst '\$NGINX_HOST \$NGINX_PORT \$LDAP_URL \$LDAP_BIND_DN \$LDAP_BIND_DN_PASSWD \$LDAP_GROUP_ATTRIBUTE \$LDAP_GROUP_ATTRIBUTE_IS_DN \$LDAP_REQUIRE_GROUP'< /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf && dockerize -stdout /var/log/nginx/access.log -stderr /var/log/nginx/error.log /usr/sbin/nginx -g 'daemon off;'"