Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.git/
.github/
.venv/
__pycache__/
*.pyc
*.pyo
node_modules/
app/
tests/
docs/
models/
*.egg-info/
dist/
build/
.pytest_cache/
.coverage
htmlcov/
.tox/
.env
.env.*
.ruff_cache/
4 changes: 4 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,9 @@ jobs:
platforms: linux/amd64
push: true
tags: ${{ steps.tag.outputs.tags }}
labels: |
org.opencontainers.image.source=https://github.com/daydreamlive/scope
org.opencontainers.image.description=Daydream Scope
org.opencontainers.image.licenses=MIT
cache-from: type=gha
cache-to: type=gha,mode=max
66 changes: 49 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,48 +1,80 @@
FROM nvidia/cuda:12.8.0-cudnn-runtime-ubuntu22.04
# Stage 1: Builder
FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04 AS builder

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV CUDA_VISIBLE_DEVICES=0
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
ENV DAYDREAM_SCOPE_LOGS_DIR=/workspace/logs
ENV DAYDREAM_SCOPE_MODELS_DIR=/workspace/models

WORKDIR /app

RUN apt-get update && apt-get install -y \
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
git \
build-essential \
software-properties-common \
# Dependencies required for OpenCV
python3-dev \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
python3-dev \
# Cleanup
&& rm -rf /var/lib/apt/lists/*

# Install Node.js 20.x
# Install Node.js 20.x (only needed for frontend build)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
&& apt-get install -y --no-install-recommends nodejs \
&& rm -rf /var/lib/apt/lists/*

# Install uv (Python package manager)
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:$PATH"

# Install Python dependencies
# Install Python dependencies (no dev deps, clean cache)
COPY pyproject.toml uv.lock README.md .python-version LICENSE.md patches.pth .
RUN uv sync --frozen
RUN uv sync --frozen --no-dev && uv cache clean

# Build frontend
COPY frontend/ ./frontend/
RUN cd frontend && npm install && npm run build

# Stage 2: Runtime (no Node.js, no build tools, no caches)
FROM nvidia/cuda:12.8.0-runtime-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
ENV CUDA_VISIBLE_DEVICES=0
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
ENV DAYDREAM_SCOPE_LOGS_DIR=/workspace/logs
ENV DAYDREAM_SCOPE_MODELS_DIR=/workspace/models

WORKDIR /app

# Runtime-only system dependencies (OpenCV, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*

# Copy uv binary
COPY --from=builder /root/.local/bin/uv /root/.local/bin/uv
COPY --from=builder /root/.local/bin/uvx /root/.local/bin/uvx
ENV PATH="/root/.local/bin:$PATH"

# Copy Python virtual environment and project metadata
COPY --from=builder /app/.venv /app/.venv
COPY --from=builder /app/pyproject.toml /app/pyproject.toml
COPY --from=builder /app/uv.lock /app/uv.lock
COPY --from=builder /app/.python-version /app/.python-version
COPY --from=builder /app/README.md /app/README.md
COPY --from=builder /app/LICENSE.md /app/LICENSE.md
COPY --from=builder /app/patches.pth /app/patches.pth

# Copy built frontend
COPY --from=builder /app/frontend/dist /app/frontend/dist

# Copy project files
COPY src/ /app/src/

Expand Down
Loading