-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
54 lines (36 loc) · 1.18 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
FROM pypy:3.8-slim as base
ENV PYTHONUNBUFFERED 1
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y upgrade
RUN pip install virtualenv
ENV PATH="/venv/bin:$PATH"
RUN virtualenv /venv
FROM base as builder
RUN apt-get -y install --no-install-recommends syslog-ng postgresql build-essential libpq-dev
WORKDIR /venv
RUN /bin/bash -c "source /venv/bin/activate"
COPY requirements.txt /venv/requirements.txt
RUN pip install psycopg2cffi --no-cache-dir
RUN pip install -r requirements.txt --no-cache-dir
RUN pip install gunicorn
RUN rm /venv/requirements.txt
WORKDIR /cms
COPY . .
RUN python -m compileall . -b
RUN find . -name "*.py" -exec rm -rf {} \;
RUN rm requirements.txt
RUN rm Dockerfile
FROM base as packager
RUN apt-get -y install --no-install-recommends libpq-dev
COPY --from=builder /venv /venv
COPY --from=builder /cms /cms
WORKDIR /cms
RUN /bin/bash -c "source /venv/bin/activate"
ENV WEB_CONCURRENCY 5
ENV PORT 8000
ENV MAX_REQUESTS 1000
ENV MAX_REQUESTS_JITTER 50
ENV TIMEOUT 30
EXPOSE $PORT
CMD gunicorn --timeout $TIMEOUT --max-requests $MAX_REQUESTS --max-requests-jitter $MAX_REQUESTS_JITTER --workers $WEB_CONCURRENCY -b [::]:$PORT --log-level=error cms.wsgi