-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
65 lines (50 loc) · 1.39 KB
/
Copy pathDockerfile
File metadata and controls
65 lines (50 loc) · 1.39 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
FROM python:3.14-slim-bookworm AS builder
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libstdc++-12-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --no-cache-dir \
"cmake>=3.31.0" \
uvloop \
httptools \
websockets \
pandas \
pybind11 \
fastapi \
uvicorn \
google-cloud-storage \
google-genai
COPY core/ /build/core
WORKDIR /build/core
RUN cmake -DCMAKE_BUILD_TYPE=Release . \
&& make -j$(nproc) \
&& strip --strip-unneeded genetic_core*.so \
&& cp genetic_core*.so /opt/venv/lib/python3.14/site-packages/
FROM python:3.14-slim-bookworm AS runtime
WORKDIR /opt/pharmashield
COPY --from=builder /opt/venv /opt/venv
COPY app/ ./app/
COPY frontend/ ./frontend/
RUN touch ./app/__init__.py ./app/api/__init__.py ./app/core/__init__.py
ENV PYTHONPATH="/opt/venv/lib/python3.14/site-packages:/opt/pharmashield"
ENV PATH="/opt/venv/bin:$PATH"
ENV PYTHONUNBUFFERED=1
ENV GC_DISABLE=0
RUN useradd -m -u 1000 pharmashield
USER pharmashield
EXPOSE 8080
ENTRYPOINT [ \
"python", "-m", "uvicorn", \
"app.main:app", \
"--host", "0.0.0.0", \
"--port", "8080", \
"--workers", "1", \
"--loop", "uvloop", \
"--http", "httptools", \
"--no-access-log" \
]