-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
36 lines (26 loc) · 1.02 KB
/
Dockerfile.backend
File metadata and controls
36 lines (26 loc) · 1.02 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
# Stage 1: Build dependencies
FROM python:3.14-slim AS builder
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
COPY pyproject.toml uv.lock ./
# Install all production deps from lockfile
RUN uv sync --frozen --no-dev --no-editable
# Replace PyTorch with CPU-only build to avoid CUDA wheels (~2.5GB) on x86_64
RUN uv pip install --python /app/.venv/bin/python \
torch --index-url https://download.pytorch.org/whl/cpu
# Replace opencv-python with headless variant (no X11/GUI libs needed in container)
RUN uv pip install --python /app/.venv/bin/python opencv-python-headless
# Stage 2: Runtime
FROM python:3.14-slim AS runner
RUN apt-get update \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/.venv /app/.venv
COPY app/ ./app/
COPY plugins/ ./plugins/
ENV PATH="/app/.venv/bin:$PATH"
ENV DATAVISOR_HOST=0.0.0.0
ENV DATAVISOR_PORT=8000
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]