-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (51 loc) · 1.92 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
FROM python:3.8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Create a non-root user
RUN groupadd --system django && useradd --system --gid django django
# Install dependencies
RUN apt-get update \
&& apt-get install -y build-essential gcc libcairo2 libffi-dev \
libgdk-pixbuf2.0-0 libpango-1.0-0 libpangocairo-1.0-0 poppler-utils \
python3-cffi shared-mime-info \
libpq-dev python3-dev \
file\
&& rm -rf /var/lib/apt/lists/*
# Install pip packages
RUN pip install --upgrade pip \
&& pip install --upgrade setuptools \
&& pip install --upgrade supervisor
WORKDIR /
COPY requirements.txt /
RUN pip install -r requirements.txt
# Create the static_backend volume as a directory
RUN mkdir -p /static_backend \
&& chown -R django:django /static_backend \
&& chmod -R o+r /static_backend
# Create the supervisor configuration files volume as a directory
RUN mkdir -p /supervisor.d \
&& chown -R django:django /supervisor.d \
&& chmod -R o+r /supervisor.d
# Create the web server logs volume as a directory
RUN mkdir -p /web_server_logs/supervisord_logs \
&& mkdir -p /web_server_logs/gunicorn_logs \
&& mkdir -p /web_server_logs/server_logs \
&& chown -R django:django /web_server_logs \
&& chmod -R o+r /web_server_logs
# Create the history volume as a directory
RUN mkdir -p /.history \
&& chown -R django:django /.history \
&& chmod -R o+r /.history
# Change the directories into volumes
VOLUME /web_server_logs /supervisor.d /.history /static_backend
# Copy the supervisord.conf file over to the container
COPY ./supervisord.conf ./supervisord.conf
# Copy the gunicorn_config.py file over to the container
COPY ./gunicorn_config.py ./gunicorn_config.py
# Define environment variables
ENV PYTHONPATH="/app"
ENV HISTFILE="/.history/.bash_history"
ENV IPYTHONDIR="/.history/.ipython/"
# Add some terminal jazz
RUN echo "PS1='docker@\$NAME:\w\$ '" >> /etc/bash.bashrc
WORKDIR /app