-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (50 loc) · 2.32 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (50 loc) · 2.32 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
# =============================================================================
# Datarax — Development & GPU Runtime Image
# =============================================================================
# For users running datarax pipelines, tests, and examples in a container.
# Does NOT include the `benchmark` extra (adds ~10GB of competing frameworks).
# For benchmarking images, see benchmarks/docker/Dockerfile.{cpu,gpu,tpu}.
#
# Build: docker build -t datarax:latest .
# Run: docker run --rm --gpus all datarax:latest python -c "import datarax, jax; print(jax.devices())"
# Test: docker run --rm -e JAX_PLATFORMS=cpu datarax:latest python -m pytest tests/ -x -q
# =============================================================================
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# JAX runtime defaults — prevent full GPU memory preallocation
ENV XLA_PYTHON_CLIENT_PREALLOCATE=false
ENV XLA_PYTHON_CLIENT_MEM_FRACTION=0.75
# System dependencies + Python 3.11
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.11 \
python3.11-venv \
python3.11-dev \
python3-pip \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN ln -sf /usr/bin/python3.11 /usr/bin/python
# Install uv — single-layer binary copy from official OCI image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
WORKDIR /app
# --- Layer 1: Dependencies (cached unless pyproject.toml or uv.lock change) ---
COPY pyproject.toml uv.lock README.md LICENSE ./
RUN uv venv /app/.venv
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install main + dev/gpu/test/data extras (not benchmark, not docs)
RUN uv pip install -e ".[dev,gpu,test,data]"
# --- Layer 2: Source code (changes frequently, invalidates only this layer) ---
COPY src ./src
COPY tests ./tests
COPY scripts ./scripts
COPY examples ./examples
COPY benchmarks ./benchmarks
COPY conftest.py ./conftest.py
# Reinstall datarax in editable mode now that source is present
RUN uv pip install -e ".[dev,gpu,test,data]"
# Verify JAX can import (allow failure on CPU-only build hosts)
RUN python -c "import jax; print(f'JAX {jax.__version__}, devices: {jax.devices()}')" || true
# Default command — overridable at runtime
CMD ["python", "scripts/distributed_test_runner.py"]