mirror of
https://github.com/hanzoai/engine.git
synced 2026-11-20 14:17:52 +00:00
Per-arch root causes (v1.7.6 / v1.7.8 all red):
* cuda/rocm: RUSTFLAGS + thread caps were declared as ARG, so cargo never
saw them -> unbounded parallel rustc OOM-killed the ARC pod mid-compile
("the runner has received a shutdown signal"). Move them to ENV, cap
CARGO_BUILD_JOBS=2 (matches release.yml), and set RUSTFLAGS="" to strip
.cargo/config.toml target-cpu=native (SIGILL on other hosts). CUDA_COMPUTE_CAP
is now ENV too: as ARG-only, build.rs ignored it and every matrix leg built
the default cap.
* cpu: the reusable multi-arch Build engine workflow hung 48h on the arm64
self-hosted runner (lossy GHCR uploads). Replace with self-contained
build_cpu.yaml (amd64-only, mirrors cuda/rocm). Dockerfile now builds only
hanzo-server + hanzo-bench with capped jobs (a full --workspace build OOMed).
* triggers: drop 'release: published' (a GITHUB_TOKEN-created release emits no
triggering event) and the broken '**[0-9]+...' tag glob. All image builds
fire on the version tag push, same event as release.yml.
* cap cuda matrix at max-parallel 2; bump checkout/cache to v4.
82 lines
2.8 KiB
Docker
82 lines
2.8 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ROCm/HIP image for AMD GPUs. Defaults to gfx942 (MI300, ROCm 6.4); set
|
|
# ROCM_GFX_ARCH=gfx90a for MI200. For gfx1151 (Strix Halo) pass a ROCm 7.x base
|
|
# (ROCM_BASE=rocm/dev-ubuntu-24.04:7.2.4) plus ROCM_GFX_ARCH=gfx1151.
|
|
ARG ROCM_BASE=rocm/dev-ubuntu-24.04:6.4.4
|
|
|
|
# Stage 1: Build environment
|
|
FROM ${ROCM_BASE} AS builder
|
|
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
RUN <<HEREDOC
|
|
for i in 1 2 3 4 5; do apt-get -o Acquire::Retries=3 update && break; echo "apt-get update failed (attempt $i/5), mirror may be syncing; retrying in 15s"; sleep 15; done
|
|
apt-get install -y --no-install-recommends \
|
|
curl \
|
|
git \
|
|
libclang-dev \
|
|
libssl-dev \
|
|
miopen-hip-dev \
|
|
pkg-config \
|
|
rocblas-dev \
|
|
rocfft-dev \
|
|
rocrand-dev \
|
|
rocsolver-dev \
|
|
rocsparse-dev
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
HEREDOC
|
|
|
|
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
|
|
ENV ROCM_PATH=/opt/rocm
|
|
ENV PATH="/root/.cargo/bin:/opt/rocm/bin:${PATH}"
|
|
RUN rustup update nightly && rustup default nightly
|
|
|
|
WORKDIR /hanzo
|
|
COPY . .
|
|
|
|
# ROCM_GFX_ARCH is read by build.rs to compile the HIP kernels for the target ISA.
|
|
ARG ROCM_GFX_ARCH=gfx942
|
|
ENV ROCM_GFX_ARCH=${ROCM_GFX_ARCH}
|
|
ARG WITH_FEATURES="rocm"
|
|
# Portable, memory-bounded release build. These MUST be ENV, not ARG, or cargo
|
|
# never sees them:
|
|
# RUSTFLAGS="" overrides .cargo/config.toml `target-cpu=native` (SIGILL on
|
|
# other hosts otherwise).
|
|
# CARGO_BUILD_JOBS=2 caps concurrent rustc so the ARC pod does not OOM (the
|
|
# unbounded default recycled the runner mid-compile).
|
|
ENV RUSTFLAGS="" \
|
|
CARGO_INCREMENTAL=0 \
|
|
CARGO_NET_RETRY=5 \
|
|
CARGO_BUILD_JOBS=2 \
|
|
RAYON_NUM_THREADS=4
|
|
# Only the two binaries the runtime stage copies (hanzo-server, hanzo-bench).
|
|
RUN cargo build --release -p hanzo-server -p hanzo-bench --features "${WITH_FEATURES}"
|
|
|
|
|
|
# Stage 2: Minimal runtime environment
|
|
FROM ${ROCM_BASE} AS runtime
|
|
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
RUN <<HEREDOC
|
|
for i in 1 2 3 4 5; do apt-get -o Acquire::Retries=3 update && break; echo "apt-get update failed (attempt $i/5), mirror may be syncing; retrying in 15s"; sleep 15; done
|
|
apt-get install -y --no-install-recommends \
|
|
libomp-dev \
|
|
ca-certificates \
|
|
libssl-dev \
|
|
curl \
|
|
pkg-config
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
HEREDOC
|
|
|
|
COPY --chmod=755 --from=builder /hanzo/target/release/hanzo-bench /usr/local/bin/hanzo-bench
|
|
COPY --chmod=755 --from=builder /hanzo/target/release/hanzo-server /usr/local/bin/hanzo-server
|
|
# Copy chat templates for users running models which may not include them
|
|
COPY --from=builder /hanzo/chat_templates /chat_templates
|
|
|
|
ENV HUGGINGFACE_HUB_CACHE=/data \
|
|
PORT=80
|