forked from praekeltfoundation/docker-django-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebian.dockerfile
46 lines (37 loc) · 1.57 KB
/
debian.dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
FROM praekeltfoundation/python3-base:debian
MAINTAINER Praekelt Foundation <dev@praekeltfoundation.org>
# Install libpq for PostgreSQL support and Nginx to serve everything
# Get Nginx from the upstream repo so that we're up-to-date with Alpine and have
# a compatible config file.
ENV NGINX_VERSION 1.10.1-1~jessie
RUN apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62 \
&& echo "deb http://nginx.org/packages/debian/ jessie nginx" >> /etc/apt/sources.list \
&& apt-get-install.sh \
libpq5 \
nginx=${NGINX_VERSION}
# Install gunicorn
RUN pip install gunicorn
# Copy in the Nginx config
COPY ./nginx/ /etc/nginx/
RUN rm /etc/nginx/conf.d/default.conf
# Create gunicorn user and group, make directory for socket, and add nginx user
# to gunicorn group so that it can read/write to the socket.
RUN addgroup gunicorn \
&& adduser --system --ingroup gunicorn gunicorn \
&& mkdir /var/run/gunicorn \
&& chown gunicorn:gunicorn /var/run/gunicorn \
&& adduser nginx gunicorn
# Create celery user and group, make directory for beat schedule file.
RUN addgroup celery \
&& adduser --system --ingroup celery celery \
&& mkdir /var/run/celery \
&& chown celery:celery /var/run/celery
EXPOSE 8000
COPY ./django-entrypoint.sh /scripts/
CMD ["django-entrypoint.sh"]
WORKDIR /app
ONBUILD COPY . /app
# chown the app directory after copying in case the copied files include
# subdirectories that will be written to, e.g. the media directory
ONBUILD RUN chown -R gunicorn:gunicorn /app
ONBUILD RUN pip install -e .