-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
52 lines (43 loc) · 1.36 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
###########
# BUILDER #
###########
FROM clinicalgenomics/python3.11-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
RUN pip install "poetry<1.8"
COPY poetry.lock pyproject.toml ./
RUN poetry config virtualenvs.create false
RUN poetry install --no-interaction
#########
# FINAL #
#########
FROM clinicalgenomics/python3.11-venv:1.0
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 . .
# 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"
ENV GUNICORN_WORKERS=1
ENV GUNICORN_THREADS=1
ENV GUNICORN_BIND="0.0.0.0:8000"
ENV GUNICORN_TIMEOUT=400
ENTRYPOINT ["/bin/sh", "-c", "gunicorn \
--workers=${GUNICORN_WORKERS} \
--worker-class=uvicorn.workers.UvicornWorker \
--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 \
preClinVar.main:app"]