Dockerfile 1.37 KB
Newer Older
Thom Wiggers's avatar
Thom Wiggers committed
1
FROM python:3.5
Thom Wiggers's avatar
Thom Wiggers committed
2
3
4
5
6
7
8
9
MAINTAINER Thom Wiggers <thom@thomwiggers.nl>
LABEL description="Contains the Thaliawebsite Django application"

# Try to keep static operation on top to maximise Docker cache utilisation

# Disable output buffering
ENV DJANGO_PRODUCTION 1
ENV PYTHONUNBUFFERED 1
Thom Wiggers's avatar
Thom Wiggers committed
10
ENV DEBIAN_FRONTEND=noninteractive
Thom Wiggers's avatar
Thom Wiggers committed
11

Thom Wiggers's avatar
Thom Wiggers committed
12
13
14
15
16
17
18
19
# Create /concrexit dir
# Create log dir and log file
# Create app dir
RUN mkdir /concrexit && \
    mkdir -p /concrexit/log/ && \
    touch /concrexit/log/uwsgi.log && \
    chown -R www-data:www-data /concrexit && \
    mkdir -p /usr/src/app
Thom Wiggers's avatar
Thom Wiggers committed
20
21

# Install dependencies
Thom Wiggers's avatar
Thom Wiggers committed
22
RUN apt-get update && apt-get install -y --no-install-recommends \
Thom Wiggers's avatar
Thom Wiggers committed
23
    postgresql-client \
Thom Wiggers's avatar
Thom Wiggers committed
24
25
26
    gettext \
    ghostscript && \
    rm -rf /var/lib/apt
Thom Wiggers's avatar
Thom Wiggers committed
27

Thom Wiggers's avatar
Thom Wiggers committed
28
29
30
31
WORKDIR /usr/src/app
# install python requirements
COPY requirements.txt /usr/src/app/
COPY production-requirements.txt /usr/src/app/
Thom Wiggers's avatar
Thom Wiggers committed
32
COPY dev-requirements.txt /usr/src/app/
Thom Wiggers's avatar
Thom Wiggers committed
33
34
RUN pip install --no-cache-dir \
    -r requirements.txt \
Thom Wiggers's avatar
Thom Wiggers committed
35
36
    -r production-requirements.txt \
    -r dev-requirements.txt
Thom Wiggers's avatar
Thom Wiggers committed
37

Thom Wiggers's avatar
Thom Wiggers committed
38
39
40
# Create entry points
COPY resources/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY resources/entrypoint_production.sh /usr/local/bin/entrypoint_production.sh
Thom Wiggers's avatar
Thom Wiggers committed
41
42
RUN chmod +x /usr/local/bin/entrypoint.sh && \
    chmod +x /usr/local/bin/entrypoint_production.sh
Thom Wiggers's avatar
Thom Wiggers committed
43

Thom Wiggers's avatar
Thom Wiggers committed
44
45
46
47
48
# copy app source
COPY website /usr/src/app/

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["--help"]