-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile-server
55 lines (42 loc) · 1.28 KB
/
Dockerfile-server
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
###########
# BUILDER #
###########
FROM clinicalgenomics/python3.8-venv:1.0 AS builder
# Install and run commands from virtual environment
RUN python3 -m venv /home/worker/venv
ENV PATH="/home/worker/venv/bin:$PATH"
# install requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
#########
# FINAL #
#########
FROM clinicalgenomics/python3.8-venv:1.0 AS deployer
RUN groupadd --gid 1000 worker && useradd -g worker --uid 1000 --create-home worker
COPY --chown=worker:worker --from=builder /home/worker/venv /home/worker/venv
RUN mkdir /home/worker/app
WORKDIR /home/worker/app
COPY . .
USER worker
# make sure all messages always reach console
ENV PYTHONUNBUFFERED=1
# activate virtual environment
ENV VIRTUAL_ENV=/home/worker/venv
ENV PATH="/home/worker/venv/bin:$PATH"
RUN pip install --no-cache-dir gunicorn
ENV GUNICORN_WORKERS=1
ENV GUNICORN_THREADS=1
ENV GUNICORN_BIND="0.0.0.0:8000"
ENV GUNICORN_TIMEOUT=400
CMD gunicorn \
--workers=$GUNICORN_WORKERS \
--bind=$GUNICORN_BIND \
--threads=$GUNICORN_THREADS \
--timeout=$GUNICORN_TIMEOUT \
--proxy-protocol \
--forwarded-allow-ips="10.0.2.100,127.0.0.1" \
--log-syslog \
--access-logfile - \
--error-logfile - \
--log-level="debug" \
patientMatcher.server.auto:app