Dockerfile 811 Bytes
Newer Older
Jon Yu's avatar
Jon Yu committed
1
2
FROM python:3.8-slim

3
4
ARG ENVIRONMENT="PRODUCTION"

Jon Yu's avatar
Jon Yu committed
5
6
7
ENV GUNICORN_WORKERS=2
ENV GUNICORN_THREADS=4

Jon Yu's avatar
Jon Yu committed
8
9
10
ENV PYTHONUNBUFFERED=1
ENV PIP_DISABLE_PIP_VERSION_CHECK=1

Jon Yu's avatar
Jon Yu committed
11
12
RUN apt-get -y update && apt-get install -y libpq-dev gcc

Jon Yu's avatar
Jon Yu committed
13
14
15
16
WORKDIR /usr/src/app

COPY . /usr/src/app

17
18
19
20
21
22
RUN set -x; \
        if [ "${ENVIRONMENT}" = "DEVELOPMENT" ]; then \
            pip install -r requirements.txt; \
        else \
            pip install -r requirements.prod.txt; \
        fi;
Jon Yu's avatar
Jon Yu committed
23

Jon Yu's avatar
Jon Yu committed
24
25
RUN apt-get purge -y --auto-remove gcc

Jon Yu's avatar
Jon Yu committed
26
27
28
29
30
31
32
# Workaround for permission issue on OpenShift
RUN chmod -R g+rw /usr/src/app

EXPOSE 8000

ENTRYPOINT ["/usr/src/app/docker-entrypoint.sh"]

33
CMD ["gunicorn", "--bind=0.0.0.0:8000", "--workers=${GUNICORN_WORKERS}", "--threads=${GUNICORN_THREADS}", "--access-logfile=-", "--log-file=-", "{{ project_name }}.wsgi"]