forked from NVlabs/alpasim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (39 loc) · 1.43 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (39 loc) · 1.43 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
# Build command (run from repo root):
# docker build -t alpasim-base .
#
# For private dependencies (requires ~/.netrc with credentials):
# docker build --secret id=netrc,src=$HOME/.netrc -t alpasim-base .
#
# Automatically detects architecture:
# x86_64 -> nvidia/cuda base
# aarch64 -> NGC PyTorch base (only CUDA-enabled PyTorch source on ARM)
FROM nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 AS base-amd64
FROM nvcr.io/nvidia/pytorch:25.08-py3 AS base-arm64
ARG TARGETARCH
FROM base-${TARGETARCH}
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN apt-get update && apt-get install -y \
git \
ffmpeg \
curl \
build-essential \
libgl1 \
&& rm -rf /var/lib/apt/lists/*
# Install Rust toolchain (required for utils_rs maturin build)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
COPY . /repo
# Configure uv
ENV UV_LINK_MODE=copy
# Compile protos
WORKDIR /repo/src/grpc
RUN --mount=type=secret,id=netrc,target=/root/.netrc \
--mount=type=cache,target=/root/.cache/uv \
sh -c 'if [ -f /root/.netrc ]; then export NETRC=/root/.netrc; fi && uv sync'
RUN uv run compile-protos --no-sync
WORKDIR /repo
RUN --mount=type=secret,id=netrc,target=/root/.netrc \
--mount=type=cache,target=/root/.cache/uv \
sh -c 'if [ -f /root/.netrc ]; then export NETRC=/root/.netrc; fi && uv sync --extra all'
ENV UV_CACHE_DIR=/tmp/uv-cache
ENV UV_NO_SYNC=1