forked from josuav1/MPContribs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
79 lines (63 loc) · 2.56 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# https://www.caktusgroup.com/blog/2017/03/14/production-ready-dockerfile-your-python-django-app/
FROM python:3.7-slim
RUN set -ex \
&& RUN_DEPS=" \
libpcre3 \
mime-support \
postgresql-client \
curl \
software-properties-common \
git \
" \
&& seq 1 8 | xargs -I{} mkdir -p /usr/share/man/man{} \
&& apt-get update && apt-get install -y --no-install-recommends $RUN_DEPS \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*
RUN node -v && npm -v && git --version
COPY mpcontribs-utils/requirements.txt requirements-utils.txt
COPY mpcontribs-portal/requirements.txt requirements-portal.txt
COPY mpcontribs-explorer/requirements.txt requirements-explorer.txt
COPY mpcontribs-users/requirements.txt requirements-users.txt
COPY mpcontribs-webtzite/requirements.txt requirements-webtzite.txt
RUN cat requirements-*.txt > requirements.txt
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
libpcre3-dev \
libpq-dev \
" \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
&& python3.7 -m venv /venv \
&& /venv/bin/pip install -U pip \
&& /venv/bin/pip install --no-cache-dir -r /requirements.txt \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
&& rm -rf /var/lib/apt/lists/*
EXPOSE 8080
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
WORKDIR /app
RUN mkdir -p mpcontribs-webtzite/webtzite
COPY mpcontribs-webtzite/webtzite/package.json mpcontribs-webtzite/webtzite/
COPY package.json .
RUN npm install 2>&1
COPY mpcontribs-utils mpcontribs-utils
RUN cd mpcontribs-utils && /venv/bin/pip install -e .
COPY mpcontribs-webtzite mpcontribs-webtzite
RUN cd mpcontribs-webtzite && /venv/bin/pip install -e .
COPY mpcontribs-portal mpcontribs-portal
RUN cd mpcontribs-portal && /venv/bin/pip install -e .
COPY mpcontribs-users mpcontribs-users
RUN cd mpcontribs-users && /venv/bin/pip install -e .
COPY mpcontribs-explorer mpcontribs-explorer
RUN cd mpcontribs-explorer && /venv/bin/pip install -e .
COPY test_site test_site
COPY webpack.config.js .
RUN npm run webpack 2>&1
ENV DJANGO_SETTINGS_MODULE=test_site.settings
COPY manage.py .
RUN /venv/bin/python manage.py collectstatic --noinput
COPY docker-entrypoint.sh .
RUN chmod +x /app/docker-entrypoint.sh
ENTRYPOINT ["/app/docker-entrypoint.sh"]
CMD ["/venv/bin/gunicorn", "-b", "0.0.0.0:8080", "-k", "gevent", "-w", "4", "test_site.wsgi:application"]