-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-django
61 lines (43 loc) · 1.69 KB
/
Dockerfile-django
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
# base image
FROM ubuntu
# Disable bytecode writing: Python
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# ----- SETUP -------------------
# vars inside the container
ENV RIBXZ_API=/home/ribxz_api
ENV RIBCTL=/home/ribctl
ENV NEO4J_RIBOSOME=/home/neo4j_ribosome
# set work directory
RUN mkdir -p $RIBXZ_API
RUN mkdir -p $RIBCTL
# ----- LIBS -------------------------------------------
RUN apt-get update -y && apt-get -y install curl
RUN apt-get install software-properties-common -y
RUN add-apt-repository --remove ppa:ondrej/php
RUN apt-get install git vim apt-transport-https python3 \
build-essential python3-dev python3-pip python3-venv \
libglew-dev libpng-dev libfreetype6-dev libxml2-dev \
libmsgpack-dev python3-pyqt5.qtopengl libglm-dev libnetcdf-dev \
apt-transport-https ca-certificates libssl-dev wget -y
# -------------------------------------------------------------
# ------- WORKDIR $DJANGO ---------------
ADD api/reqs.txt $RIBXZ_API
RUN python3 -m venv "/opt/venv"
ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install virtualenv netCDF4
RUN pip3 install -r ${RIBXZ_API}/reqs.txt
RUN pip3 install pytz --upgrade
RUN pip3 install tzdata --upgrade
RUN pip3 install gunicorn
COPY api ${RIBXZ_API}
RUN pip3 install -r ${RIBXZ_API}/reqs.txt
# Django ports
EXPOSE 8000 8001 8002
# Be careful given that both the whole django project and the main module are called `rbxz_bend`. (hence not using the $DJANGO here)
COPY ribctl ${RIBCTL}
COPY neo4j_ribosome ${NEO4J_RIBOSOME}
WORKDIR ${RIBXZ_API}
ENV RIBETL_DATA ${RIBETL_DATA}
RUN python manage.py collectstatic --noinput
ENTRYPOINT ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "10", "ribxz_api.wsgi:application","--reload", "--timeout", "500"]