| ARG RELEASE |
| ARG LAUNCHPAD_BUILD_ARCH |
| LABEL org.opencontainers.image.version=24.04 |
| ADD file:8ce1caf246e7c778bca84c516d02fd4e83766bb2c530a0fffa8a351b560a2728 in / |
| CMD ["/bin/bash"] |
| ARG BASE_IMAGE=ubuntu:24.04 |
| ARG PYTHON_VERSION=3.12 |
| ARG PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 |
| ARG TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 |
| ARG TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f |
| ARG TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 |
| ARG APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 |
| ARG ROCM_VERSION=7.2.4 |
| ARG UBUNTU_VERSION=24.04 |
| ARG PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ |
| LABEL org.opencontainers.image.ref.name=rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0+rocm7.2.4.lw.git3d3aa833 |
| ENV DEBIAN_FRONTEND=noninteractive |
| RUN |10 BASE_IMAGE=ubuntu:24.04 PYTHON_VERSION=3.12 PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 ROCM_VERSION=7.2.4 UBUNTU_VERSION=24.04 PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ /bin/sh -c echo "tzdata tzdata/Areas select Etc" | debconf-set-selections && echo "tzdata tzdata/Zones/Etc select UTC" | debconf-set-selections # buildkit |
| RUN |10 BASE_IMAGE=ubuntu:24.04 PYTHON_VERSION=3.12 PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 ROCM_VERSION=7.2.4 UBUNTU_VERSION=24.04 PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ /bin/sh -c apt update && apt install -y wget software-properties-common curl rsync dialog git gnupg # buildkit |
| ENV PATH=/opt/rocm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin LD_LIBRARY_PATH=/opt/rocm/lib |
| RUN |10 BASE_IMAGE=ubuntu:24.04 PYTHON_VERSION=3.12 PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 ROCM_VERSION=7.2.4 UBUNTU_VERSION=24.04 PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ /bin/sh -c add-apt-repository ppa:deadsnakes/ppa && apt update && apt install -y python${PYTHON_VERSION} python3-pip python3-venv && if [ "${PYTHON_VERSION}" = "3.10" ]; then apt install -y --no-install-recommends python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-distutils python${PYTHON_VERSION}-venv; elif [ "${PYTHON_VERSION}" = "3.12" ]; then apt install -y --no-install-recommends python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv; else echo "Only PYTHON_VERSION 3.10 or 3.12 is supported" && exit 1; fi && apt clean && rm -rf /var/lib/apt/lists/* # buildkit |
| RUN |10 BASE_IMAGE=ubuntu:24.04 PYTHON_VERSION=3.12 PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 ROCM_VERSION=7.2.4 UBUNTU_VERSION=24.04 PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ /bin/sh -c python${PYTHON_VERSION} -m venv /opt/venv && . /opt/venv/bin/activate && /opt/venv/bin/python -m pip install --upgrade pip setuptools && /opt/venv/bin/python -m pip install hypothesis scipy ninja # buildkit |
| ENV PATH=/opt/venv/bin:/opt/rocm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| RUN |10 BASE_IMAGE=ubuntu:24.04 PYTHON_VERSION=3.12 PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 ROCM_VERSION=7.2.4 UBUNTU_VERSION=24.04 PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ /bin/sh -c set -eux; mkdir -p --mode=0755 /etc/apt/keyrings; wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null; if [ "$PYTHON_VERSION" = "3.12" ]; then CODENAME=noble; elif [ "$PYTHON_VERSION" = "3.10" ]; then CODENAME=jammy; else echo "Only PYTHON_VERSION 3.10 or 3.12 is supported" && exit 1; fi; printf 'deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/%s %s main\n' "${ROCM_VERSION}" "${CODENAME}" > /etc/apt/sources.list.d/rocm.list; printf '%s\n' 'Package: *' 'Pin: release o=repo.radeon.com' 'Pin-Priority: 600' > /etc/apt/preferences.d/rocm-pin-600; apt-get update; apt-get install -y --no-install-recommends rocm python3-setuptools python3-wheel; apt-get clean && rm -rf /var/lib/apt/lists/* # buildkit |
| RUN |10 BASE_IMAGE=ubuntu:24.04 PYTHON_VERSION=3.12 PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 ROCM_VERSION=7.2.4 UBUNTU_VERSION=24.04 PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ /bin/sh -c set -e && WHEEL_INDEX="${PYTORCH_WHEEL_INDEX:-https://repo.radeon.com/rocm/manylinux/rocm-rel-${ROCM_VERSION}/}" && echo "Installing from $WHEEL_INDEX Python $PYTHON_VERSION" && pip install --no-cache-dir --find-links "${WHEEL_INDEX}" --prefer-binary "torch==${PYTORCH_VERSION}" "torchvision==${TORCHVISION_VERSION}" "torchaudio==${TORCHAUDIO_VERSION}" "triton==${TRITON_VERSION}" && pip install --no-cache-dir --find-links "${WHEEL_INDEX}" --prefer-binary "apex==${APEX_VERSION}" && for pkg in torch torchvision torchaudio triton apex; do pip show "$pkg" >/dev/null 2>&1 || { echo "ERROR: $pkg missing"; exit 1; }; done && python -c "import torch, torchvision, torchaudio; tv=torch.__version__; vv=torchvision.__version__; av=torchaudio.__version__; assert '+rocm' in tv, f'Expected ROCm torch wheel, got: {tv}'; assert '+rocm' in vv, f'Expected ROCm torchvision wheel, got: {vv}'; assert '+rocm' in av, f'Expected ROCm torchaudio wheel, got: {av}'; print('torch:', tv, 'hip:', torch.version.hip); print('torchvision:', vv); print('torchaudio:', av)" # buildkit |
| RUN |10 BASE_IMAGE=ubuntu:24.04 PYTHON_VERSION=3.12 PYTORCH_VERSION=2.10.0+rocm7.2.4.lw.git3d3aa833 TORCHVISION_VERSION=0.25.0+rocm7.2.4.git82df5f59 TORCHAUDIO_VERSION=2.10.0+rocm7.2.4.git5047768f TRITON_VERSION=3.6.0+rocm7.2.4.git4ed88892 APEX_VERSION=1.10.0+rocm7.2.4.git751f5dd5 ROCM_VERSION=7.2.4 UBUNTU_VERSION=24.04 PYTORCH_WHEEL_INDEX=https://repo.radeon.com/rocm/manylinux/rocm-rel-7.2.4/ /bin/sh -c git clone https://github.com/ROCm/pytorch-micro-benchmarking /var/lib/jenkins/pytorch-micro-benchmarking && ln -sf /usr/bin/python3 /usr/bin/python # buildkit |
| ARG SAM3_REVISION=5dd401d1c5c1d5c3eedff06d41b77af824517619 |
| ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_DISABLE_PIP_VERSION_CHECK=1 HF_HOME=/cache/huggingface |
| WORKDIR /app |
| RUN |1 SAM3_REVISION=5dd401d1c5c1d5c3eedff06d41b77af824517619 /bin/sh -c apt-get update && apt-get install -y --no-install-recommends git libglib2.0-0 libgl1 && rm -rf /var/lib/apt/lists/* # buildkit |
| RUN |1 SAM3_REVISION=5dd401d1c5c1d5c3eedff06d41b77af824517619 /bin/sh -c python3 -m pip install --no-cache-dir 'setuptools==80.9.0' 'fastapi==0.116.1' 'uvicorn[standard]==0.35.0' 'python-multipart==0.0.20' 'pydantic==2.11.7' 'httpx==0.28.1' 'httpcore==1.0.9' 'pillow==11.3.0' 'numpy==1.26.4' 'einops==0.8.1' 'huggingface-hub==0.34.4' 'timm==1.0.19' 'ftfy==6.1.1' 'regex==2025.7.34' 'iopath==0.1.10' 'tqdm==4.67.1' 'psutil==7.0.0' 'safetensors==0.6.2' 'pycocotools==2.0.10' 'git+https://github.com/facebookresearch/sam3.git@'"${SAM3_REVISION}" && python3 -m pip check # buildkit |
| RUN |1 SAM3_REVISION=5dd401d1c5c1d5c3eedff06d41b77af824517619 /bin/sh -c 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 # buildkit |
| COPY pyproject.toml /app/ # buildkit |
| COPY ai_gateway /app/ai_gateway # buildkit |
| COPY control_panel /app/control_panel # buildkit |
| COPY scripts /app/scripts # buildkit |
| ADD https://raw.githubusercontent.com/facebookresearch/sam3/5dd401d1c5c1d5c3eedff06d41b77af824517619/assets/images/test_image.jpg /app/scripts/sam31_preflight.jpg # buildkit |
| RUN |1 SAM3_REVISION=5dd401d1c5c1d5c3eedff06d41b77af824517619 /bin/sh -c python3 -m pip install --no-cache-dir --no-deps . && python3 -c "from sam3.model_builder import build_sam3_predictor; from ai_gateway.worker_vision_runtime import Sam31Runner" && find /app -type d -name __pycache__ -prune -exec rm -rf '{}' + # buildkit |
| EXPOSE [41913/tcp] |
| CMD ["ai-gateway-worker-agent"] |