Repository navigation
Expand file tree
/
Copy pathdev.Dockerfile
More file actions
41 lines (32 loc) · 1.74 KB
/
Copy pathdev.Dockerfile
File metadata and controls
41 lines (32 loc) · 1.74 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
FROM python:3.13-slim
LABEL authors="Oleksandr Khoroshevskyi, Nathan Sheffield"
# gcc/build-essential/python3-dev: hnswlib build (geniml); libpq-dev: postgres; git: git deps
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc build-essential python3-dev libpq-dev git \
&& rm -rf /var/lib/apt/lists/*
# UCSC bigBedToBed for the /v1/bed/{id}/regions route (needs only libc)
ADD --chmod=755 https://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/bigBedToBed /usr/local/bin/bigBedToBed
ENV HNSWLIB_NO_NATIVE=1 \
PYTHONDONTWRITEBYTECODE=1
RUN pip install --no-cache-dir --upgrade pip uv
WORKDIR /app
# Install deps before copying the full source so the dep layer caches
COPY pyproject.toml /app/pyproject.toml
# Install dependencies only (from pyproject.toml), NOT bedhost itself: the app
# runs from the /app source tree copied below (uvicorn bedhost.main:app), and
# the version is read from bedhost/_version.py, so bedhost is intentionally not
# installed as a distribution here.
# --torch-backend cpu: without it, torch resolves to the CUDA build and pulls
# ~3 GB of nvidia-* libraries the server never uses.
RUN uv pip install -r pyproject.toml --torch-backend cpu --system --no-cache-dir --compile-bytecode
COPY . /app
RUN python -m compileall -q /app/bedhost
# Unprivileged runtime user. /app and site-packages stay root-owned (read-only to the app).
RUN useradd --system --uid 10001 --user-group --create-home --home-dir /home/bedhost --shell /usr/sbin/nologin bedhost
ENV HOME=/home/bedhost \
HF_HOME=/home/bedhost/.cache/huggingface \
FASTEMBED_CACHE_PATH=/home/bedhost/.cache/fastembed \
NUMBA_CACHE_DIR=/home/bedhost/.cache/numba
USER bedhost
EXPOSE 8000
CMD ["uvicorn", "bedhost.main:app", "--host", "0.0.0.0", "--port", "8000"]