-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathDockerfile-server
More file actions
70 lines (55 loc) · 2.06 KB
/
Dockerfile-server
File metadata and controls
70 lines (55 loc) · 2.06 KB
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
###########
# BUILDER #
###########
FROM ghcr.io/astral-sh/uv:python3.14-bookworm AS python-builder
WORKDIR /app
# Copy the project files needed to configure dependencies build into the image
COPY --chmod=644 pyproject.toml uv.lock README.md ./
RUN uv venv --relocatable
RUN uv sync --frozen --no-install-project --no-editable
RUN uv pip install --no-cache-dir gunicorn
#########
# FINAL #
#########
FROM ghcr.io/astral-sh/uv:python3.14-bookworm-slim
LABEL about.home="https://github.com/Clinical-Genomics/scout"
LABEL about.documentation="https://clinical-genomics.github.io/scout"
LABEL about.tags="Clinical,Variant triage,WGS,WES,Rare diseases,VCF,variants,SNV,Massively parallel sequencing,Next generation sequencing"
LABEL about.license="MIT License (MIT)"
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install --no-install-recommends git wkhtmltopdf && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create a non-root user to run commands
RUN groupadd --gid 1000 worker && useradd -g worker --uid 1000 --shell /usr/sbin/nologin --create-home worker
ENV PATH="/home/worker/app/.venv/bin:$PATH"
WORKDIR /home/worker/app
# Copy current app code to app dir
COPY --chown=root:root --chmod=755 . /home/worker/app
# Copy virtual environment from builder
COPY --from=python-builder /app/.venv /home/worker/app/.venv
# Ensure worker owns everything in venv
RUN chown -R worker:worker /home/worker/app/.venv
# Switch to non-root user
USER worker
# Install Scout app
RUN uv pip install --no-cache-dir .[coverage]
ENV GUNICORN_WORKERS=1
ENV GUNICORN_THREADS=1
ENV GUNICORN_BIND="0.0.0.0:8000"
ENV GUNICORN_TIMEOUT=400
ENV GUNICORN_MAXREQUESTS=1200
CMD ["sh", "-c", "/home/worker/app/.venv/bin/gunicorn \
--workers=$GUNICORN_WORKERS \
--bind=$GUNICORN_BIND \
--threads=$GUNICORN_THREADS \
--timeout=$GUNICORN_TIMEOUT \
--max-requests=$GUNICORN_MAXREQUESTS \
--proxy-protocol \
--forwarded-allow-ips=10.0.2.100,127.0.0.1 \
--log-syslog \
--access-logfile - \
--error-logfile - \
--log-level=debug \
scout.server.auto:app"]