-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathDockerfile.cuda
More file actions
55 lines (43 loc) · 1.91 KB
/
Copy pathDockerfile.cuda
File metadata and controls
55 lines (43 loc) · 1.91 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
# =====================================================================
# DashAI CUDA image (CUDA 12.8)
# Build with: docker build -t dashai:cuda -f Dockerfile.cuda .
# Run with: docker run --gpus all -p 8000:8000 dashai:cuda
# =====================================================================
# -------- Stage 1: build frontend static assets --------
FROM node:22-alpine AS frontend
WORKDIR /app/DashAI/front
COPY DashAI/front/ ./
RUN corepack enable && yarn install --frozen-lockfile && yarn build
# -------- Stage 2: build Python env (CUDA devel for compilers) --------
FROM nvidia/cuda:12.8.0-devel-ubuntu22.04 AS builder
WORKDIR /app
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:$LD_LIBRARY_PATH
RUN apt-get update && apt-get install -y \
python3 python3-pip python3-dev \
build-essential cmake git \
&& rm -rf /var/lib/apt/lists/*
# CUDA stub so the linker resolves libcuda at build time
RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib/x86_64-linux-gnu/libcuda.so && \
ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/lib/x86_64-linux-gnu/libcuda.so.1
COPY --from=ghcr.io/astral-sh/uv:0.11 /uv /bin/uv
# cuda extra = cu128 torch wheels + llama-cpp-python compiled with CUDA offload
COPY pyproject.toml uv.lock ./
ENV UV_PROJECT_ENVIRONMENT=/opt/venv
ENV CMAKE_ARGS="-DGGML_CUDA=on"
RUN uv sync --locked --extra cuda --no-dev --no-install-project --no-cache
# -------- Stage 3: runtime (CUDA runtime, no build tools) --------
FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04
WORKDIR /app
RUN apt-get update && apt-get install -y \
python3 \
&& rm -rf /var/lib/apt/lists/*
# copy the resolved virtualenv only (not build tools)
COPY --from=builder /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# application code
COPY . .
# built frontend from stage 1
COPY --from=frontend /app/DashAI/front/build DashAI/front/build
ENV DASHAI_HOST=0.0.0.0
EXPOSE 8000
CMD ["python3", "-m", "DashAI", "--no-browser"]