-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-gunicorn
40 lines (28 loc) · 1012 Bytes
/
Dockerfile-gunicorn
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
FROM python:3-slim
# Setting up environment
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 PYTHONUNBUFFERED=1
ARG SECRET_KEY="well-known-not-secret-key"
ENV SECRET_KEY=$SECRET_KEY
ARG DATABASE_URL="postgres://dbuser:dbuser@localhost/dbname?CONN_MAX_AGE=600"
ENV DATABASE_URL=$DATABASE_URL
ARG CELERY_BROKER_URL="redis://localhost:6379/0"
ENV CELERY_BROKER_URL=$CELERY_BROKER_URL
WORKDIR /app
# Install dependencies
RUN apt-get update -qy \
&& apt-get install -qy --no-install-recommends \
git-core \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install python dependencies
COPY requirements.txt /requirements.txt
RUN pip install --no-cache-dir -r /requirements.txt
# Copy application code
COPY maintainer maintainer
# Silence warning about the missing .env file
RUN touch /app/.env
WORKDIR /app/maintainer/
RUN python ./manage.py migrate \
&& python ./manage.py collectstatic \
&& find . -name "*.pyc" -exec rm -f {} \;
CMD ["gunicorn", "-b", "0.0.0.0:8000", "wsgi:application"]