forked from HybirdCorp/creme_crm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (42 loc) · 1.62 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
# syntax = docker/dockerfile:1.3
# FROM python:3.6-slim-buster as creme-demo
FROM python:3.7-slim-buster as creme-demo
SHELL ["/bin/bash", "-c"]
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
ENV PYTHONUNBUFFERED 1
WORKDIR /srv/creme
RUN --mount=type=cache,target=/var/cache/apt \
--mount=type=cache,target=/var/lib/apt \
set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
wait-for-it \
libpq-dev \
libmariadb-dev \
build-essential;
RUN useradd --shell /bin/bash --uid 1001 creme_user
RUN chown -R creme_user /srv
USER creme_user
COPY docker/docker_settings.py /srv/creme/docker_settings.py
ENV DJANGO_SETTINGS_MODULE docker_settings
RUN --mount=type=bind,source=.,target=/tmp/src \
--mount=type=cache,target=/srv/creme/.cache,uid=1001 \
set -eux; \
mkdir -p /srv/creme/logs; \
mkdir -p /srv/creme/data; \
cp -r /tmp/src /srv/creme/src; \
python3 -m venv /srv/creme/venv; \
/srv/creme/venv/bin/pip install --cache-dir=/srv/creme/.cache/pip --upgrade pip setuptools wheel; \
/srv/creme/venv/bin/pip install --cache-dir=/srv/creme/.cache/pip /srv/creme/src[mysql,pgsql]; \
/srv/creme/venv/bin/pip install --cache-dir=/srv/creme/.cache/pip --upgrade uWSGI supervisor; \
rm -rf /srv/creme/src; \
/srv/creme/venv/bin/creme generatemedia;
ENV PATH /srv/creme:/srv/creme/venv/bin:$PATH
COPY docker/uwsgi.ini /srv/creme/uwsgi.ini
COPY docker/wsgi.py /srv/creme/wsgi.py
COPY docker/supervisord.conf /srv/creme/supervisord.conf
COPY docker/entrypoint.sh /srv/creme/entrypoint.sh
ENTRYPOINT ["/srv/creme/entrypoint.sh"]
VOLUME /srv/creme/data
EXPOSE 80