forked from arachnys/cabot
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
77 lines (56 loc) · 1.69 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
FROM python:3.6-alpine AS builder-image
RUN apk update && apk add --no-cache \
postgresql-dev \
mariadb-dev \
py-pip \
postgresql-dev \
mariadb-dev \
mysql-client \
gcc \
curl \
curl-dev \
libcurl \
musl-dev \
libffi-dev \
openldap-dev \
ca-certificates \
cargo \
build-base \
python3-dev \
musl-dev \
libevent-dev \
bash \
git
# create and activate virtual environment
# using final folder name to avoid path issues with packages
RUN python3 -m venv /home/cabot3/venv
ENV PATH="/home/cabot3/venv/bin:$PATH"
ENV PYTHONUNBUFFERED 1
RUN pip install --upgrade pip
RUN mkdir /code
WORKDIR /code
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt \
&& pip install --no-cache-dir gunicorn
########################################################
FROM python:3.6-alpine AS runner-image
RUN apk add --no-cache libpq \
mariadb-connector-c-dev \
git
USER root
COPY --from=builder-image /home/cabot3/venv /home/cabot3/venv
RUN mkdir /home/cabot3/code
WORKDIR /home/cabot3/code
COPY ./cabot3 ./cabot3
COPY manage.py ./manage.py
COPY docker-entrypoint.sh ./docker-entrypoint.sh
EXPOSE 8000
# make sure all messages always reach console
ENV PYTHONUNBUFFERED=1
# activate virtual environment
ENV VIRTUAL_ENV=/home/cabot3/venv
ENV PATH="/home/cabot3/venv/bin:$PATH"
# /dev/shm is mapped to shared memory and should be used for gunicorn heartbeat
# this will improve performance and avoid random freezes
#CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
ENTRYPOINT ["sh","docker-entrypoint.sh"]