forked from torchbox/wagtail-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
31 lines (24 loc) · 1.01 KB
/
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
FROM kaedroho/django-base:v1-py3
# PIP requirements
ADD docker/requirements.txt docker-requirements.txt
RUN pip3 install -r docker-requirements.txt
ADD requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
# Project source code
ADD {{ project_name }}/ /app/
# Docker configuration
ADD docker/uwsgi.ini /app/uwsgi.ini
ADD docker/local.py /app/{{ project_name }}/settings/local.py
ADD docker/wsgi_docker.py /app/my_lovely_website/wsgi_docker.py
ENV PYTHONPATH /app/
ENV DJANGO_SETTINGS_MODULE my_lovely_website.settings.production
# Static files
# Note: we need to create a temporary database in order for "dj compress" to work
RUN DATABASE_URL=sqlite:///tmp/db.sqlite SECRET_KEY=build django-admin migrate --noinput > /dev/null
RUN DATABASE_URL=sqlite:///tmp/db.sqlite SECRET_KEY=build django-admin collectstatic --noinput
RUN DATABASE_URL=sqlite:///tmp/db.sqlite SECRET_KEY=build django-admin compress
RUN python3 -m whitenoise.gzip /static/
VOLUME /media/
WORKDIR /app/
CMD uwsgi --ini uwsgi.ini
EXPOSE 80