| ARG RELEASE |
| ARG LAUNCHPAD_BUILD_ARCH |
| LABEL org.opencontainers.image.version=24.04 |
| ADD file:8c609c85109d07bf47cf268a175b3be8bbe34fc0c41d15d99b090d099f4dc837 in / |
| CMD ["/bin/bash"] |
| ARG PYTHON_VERSION=3.12 |
| COPY .github/scripts/install_rocm_deps.sh /tmp/ # buildkit |
| COPY .github/scripts/install_python.sh /tmp/ # buildkit |
| RUN |1 PYTHON_VERSION=3.12 /bin/sh -c chmod +x /tmp/install_rocm_deps.sh /tmp/install_python.sh && /tmp/install_rocm_deps.sh && /tmp/install_python.sh "${PYTHON_VERSION}" # buildkit |
| RUN |1 PYTHON_VERSION=3.12 /bin/sh -c python${PYTHON_VERSION} -m venv /opt/venv && /opt/venv/bin/python -m pip install --upgrade pip && /opt/venv/bin/python -m pip install --upgrade setuptools # buildkit |
| ENV VIRTUAL_ENV=/opt/venv PATH=/opt/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| ARG ROCM_VERSION=7.14.0 |
| ARG AMDGPU_FAMILY=device-all |
| ARG RELEASE_TYPE=nightly |
| ARG PYTHON_VERSION=3.12 |
| ARG INDEX_URL=https://repo.amd.com/rocm/whl-multi-arch |
| ARG EXTRA_INDEX_URL= |
| ARG PIN_EXPLICIT_VERSIONS=true |
| ARG TORCH_VERSION=2.12.0+rocm7.14.0 |
| ARG TORCHAUDIO_VERSION |
| ARG TORCHVISION_VERSION=0.27.0+rocm7.14.0 |
| ARG APEX_VERSION |
| ARG TRITON_VERSION |
| LABEL image.title=PyTorch + ROCm runtime image (NPI) image.version=7.14.0 npi.python_version=3.12 npi.amdgpu_family=device-all npi.rocm_version=7.14.0 |
| COPY .github/scripts/install_pytorch_wheels.py /tmp/ # buildkit |
| COPY .github/scripts/detect_device_arches.py /tmp/ # buildkit |
| RUN |12 PYTHON_VERSION=3.12 ROCM_VERSION=7.14.0 AMDGPU_FAMILY=device-all RELEASE_TYPE=nightly INDEX_URL=https://repo.amd.com/rocm/whl-multi-arch EXTRA_INDEX_URL= PIN_EXPLICIT_VERSIONS=true TORCH_VERSION=2.12.0+rocm7.14.0 TORCHAUDIO_VERSION= TORCHVISION_VERSION=0.27.0+rocm7.14.0 APEX_VERSION= TRITON_VERSION= /bin/sh -c /opt/venv/bin/python -m pip install "cxxfilt>=0.2.0" "tqdm>=4.28.1" numpy "PyYAML>=5.1" "pytest>=3.5.1" "packaging>=14.0" "matplotlib>=3.8" "pandas>=2.2.2" py-cpuinfo build ninja wheel # buildkit |
| RUN |12 PYTHON_VERSION=3.12 ROCM_VERSION=7.14.0 AMDGPU_FAMILY=device-all RELEASE_TYPE=nightly INDEX_URL=https://repo.amd.com/rocm/whl-multi-arch EXTRA_INDEX_URL= PIN_EXPLICIT_VERSIONS=true TORCH_VERSION=2.12.0+rocm7.14.0 TORCHAUDIO_VERSION= TORCHVISION_VERSION=0.27.0+rocm7.14.0 APEX_VERSION= TRITON_VERSION= /bin/sh -c set -eu; PIN_EXPLICIT_FLAG=""; if [ "${PIN_EXPLICIT_VERSIONS}" = "true" ]; then PIN_EXPLICIT_FLAG="--pin-explicit-versions"; fi; /opt/venv/bin/python /tmp/install_pytorch_wheels.py --no-break-system-packages --skip-verify --device-targets "${AMDGPU_FAMILY}" --index-url "${INDEX_URL}" ${EXTRA_INDEX_URL:+--extra-index-url "${EXTRA_INDEX_URL}"} --amdgpu-family "${AMDGPU_FAMILY}" ${ROCM_VERSION:+--rocm-version "${ROCM_VERSION}"} ${PIN_EXPLICIT_FLAG} ${TORCH_VERSION:+--torch-version "${TORCH_VERSION}"} ${TORCHAUDIO_VERSION:+--torchaudio-version "${TORCHAUDIO_VERSION}"} ${TORCHVISION_VERSION:+--torchvision-version "${TORCHVISION_VERSION}"} ${APEX_VERSION:+--apex-version "${APEX_VERSION}"} ${TRITON_VERSION:+--triton-version "${TRITON_VERSION}"} # buildkit |
| RUN |12 PYTHON_VERSION=3.12 ROCM_VERSION=7.14.0 AMDGPU_FAMILY=device-all RELEASE_TYPE=nightly INDEX_URL=https://repo.amd.com/rocm/whl-multi-arch EXTRA_INDEX_URL= PIN_EXPLICIT_VERSIONS=true TORCH_VERSION=2.12.0+rocm7.14.0 TORCHAUDIO_VERSION= TORCHVISION_VERSION=0.27.0+rocm7.14.0 APEX_VERSION= TRITON_VERSION= /bin/sh -c /opt/venv/bin/python -c "import torch; import torchaudio; import torchvision; import apex; import triton; print('torch', torch.__version__); print('ROCm/HIP', torch.version.hip)" # buildkit |
| ARG UBUNTU_SNAPSHOT |
| ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_DISABLE_PIP_VERSION_CHECK=1 PIP_PREFER_BINARY=1 HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_HOME=/tmp/cache/huggingface TORCH_HOME=/tmp/cache/torch AI_GATEWAY_MODEL_ROOT=/models HOME=/tmp XDG_CACHE_HOME=/tmp/cache PIP_CACHE_DIR=/tmp/cache/pip MPLCONFIGDIR=/tmp/cache/matplotlib |
| WORKDIR /app |
| |1 UBUNTU_SNAPSHOT=20260725T000000Z /bin/sh -c printf '%s\n' 'Types: deb' "URIs: https://snapshot.ubuntu.com/ubuntu/${UBUNTU_SNAPSHOT}/" 'Suites: noble noble-updates noble-security' 'Components: main restricted universe multiverse' 'Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg' 'Check-Valid-Until: no' > /etc/apt/sources.list.d/ubuntu.sources && rm -f /etc/apt/sources.list && apt-get update && apt-get install -y --no-install-recommends ca-certificates libgl1 libglib2.0-0 libnuma1 && rm -rf /var/lib/apt/lists/* |
| COPY dir:a33d1f6c7b9da34202203a9602643d4e5297c0346d7a7bee0885dc0175ea05dc in /app/requirements |
| |1 UBUNTU_SNAPSHOT=20260725T000000Z /bin/sh -c --mount=type=cache,target=/tmp/cache/pip python3 -m pip install --no-deps --require-hashes -r requirements/locks/sam-worker.txt && python3 requirements/compat/patch_sam31_runtime.py /opt/venv/lib/python3.12/site-packages/sam3/model_builder.py && sed -i '/^[[:space:]]*offload_state_to_cpu=offload_state_to_cpu,$/d' /opt/venv/lib/python3.12/site-packages/sam3/model/sam3_base_predictor.py && sed -i 's/sdpa_kernel(SDPBackend.FLASH_ATTENTION)/sdpa_kernel(SDPBackend.MATH)/' /opt/venv/lib/python3.12/site-packages/sam3/model/decoder.py && python3 -m pip check |
| COPY dir:384ccfb35dc798456a8a3ecfcfcfd2116228ac5438cf98f475b7b00e678b263a in /app/ai_gateway |
| COPY dir:0f35f013e73d11609e52149e47a67c9b6ce6e599371f0b0a9a4ef34b40c1b9a2 in /app/scripts |
| ADD ae2a0ce7fc6108994a78a08f78eaaa6e6a72fc1d87ac238addb8c435a54bb500 in /app/scripts/sam31_preflight.jpg |
| |1 UBUNTU_SNAPSHOT=20260725T000000Z /bin/sh -c python3 -m pip check && python3 - <<'PY'
import importlib.metadata as metadata
import torch
assert metadata.version("httpx") == "0.28.1"
assert metadata.version("httpcore") == "1.0.9"
assert torch.__version__ == "2.12.0+rocm7.14.0", torch.__version__
assert torch.version.hip == "7.14.60850", torch.version.hip
from sam3.model_builder import build_sam3_predictor
from ai_gateway.worker_vision_runtime import Sam31Runner |
| |1 UBUNTU_SNAPSHOT=20260725T000000Z /bin/sh -c apt-get purge -y build-essential cmake g++ gcc git libc6-dev liblua5.1-0 linux-libc-dev vim-nox && ln -s libnuma.so.1 /usr/lib/x86_64-linux-gnu/libnuma.so && rm -rf /var/lib/apt/lists/* |
| |1 UBUNTU_SNAPSHOT=20260725T000000Z /bin/sh -c groupadd --gid 10001 ai-gateway && useradd --uid 10001 --gid 10001 --no-create-home --shell /usr/sbin/nologin ai-gateway && find /app -type d -name __pycache__ -prune -exec rm -rf '{}' + && chmod -R a+rX,a-w /app |
| USER 10001:10001 |
| EXPOSE 41913 |
| CMD ["python3", "-m", "ai_gateway.worker_agent"] |