This commit is contained in:
2026-06-03 16:19:00 +08:00
parent b92f26120e
commit e95ccb6d05
2 changed files with 25 additions and 4 deletions
+21 -4
View File
@@ -8,12 +8,17 @@
FROM ubuntu:24.04 FROM ubuntu:24.04
# -- 构建参数 --------------------------------------------------------------- # -- 构建参数 ---------------------------------------------------------------
# 改成你的 gfx 代号:gfx1201(RX 9070) gfx1200(RX 9060) gfx1100(RX 7900) gfx1101(RX 7800/7700) gfx1030(RX 6900/6800) # GPU 架构:gfx1201(RX 9070) gfx1200(RX 9060) gfx1100(RX 7900) gfx1101(RX 7800/7700) gfx1030(RX 6900/6800)
ARG ARCH=gfx1201 ARG ARCH=gfx1201
ARG PYTHON_VER=3.12 ARG PYTHON_VER=3.12
ARG VENV=/opt/mineru_venv ARG VENV=/opt/mineru_venv
ARG TORCH_INDEX=https://download.pytorch.org/whl/rocm7.2 ARG TORCH_INDEX=https://download.pytorch.org/whl/rocm7.2
# -- 代理设置(国内构建必需)------------------------------------------------
ARG HTTP_PROXY
ARG HTTPS_PROXY
ARG NO_PROXY=localhost,127.0.0.1
# -- 环境变量 --------------------------------------------------------------- # -- 环境变量 ---------------------------------------------------------------
ENV DEBIAN_FRONTEND=noninteractive \ ENV DEBIAN_FRONTEND=noninteractive \
PATH=/opt/rocm/bin:/opt/rocm/llvm/bin:${VENV}/bin:${PATH} \ PATH=/opt/rocm/bin:/opt/rocm/llvm/bin:${VENV}/bin:${PATH} \
@@ -22,14 +27,26 @@ ENV DEBIAN_FRONTEND=noninteractive \
MINERU_MODEL_SOURCE=huggingface \ MINERU_MODEL_SOURCE=huggingface \
TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 \ TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 \
HSA_ENABLE_SDMA=1 \ HSA_ENABLE_SDMA=1 \
VLLM_TARGET_DEVICE=rocm VLLM_TARGET_DEVICE=rocm \
HTTP_PROXY=${HTTP_PROXY} \
HTTPS_PROXY=${HTTPS_PROXY} \
NO_PROXY=${NO_PROXY} \
http_proxy=${HTTP_PROXY} \
https_proxy=${HTTPS_PROXY} \
no_proxy=${NO_PROXY}
WORKDIR /opt WORKDIR /opt
# =========================================================================== # ===========================================================================
# 阶段 1:安装 ROCm 7.2.1 # 阶段 1:换国内源 + 安装 ROCm 7.2.1
# =========================================================================== # ===========================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \ # Ubuntu 24.04 使用 deb822 格式,默认源文件是 /etc/apt/sources.list.d/ubuntu.sources
RUN sed -i 's|http://.*archive.ubuntu.com|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources && \
sed -i 's|http://.*security.ubuntu.com|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list.d/ubuntu.sources && \
# 如果设置了代理,配置 apt 走代理
([ -n "$HTTP_PROXY" ] && echo "Acquire::http::Proxy \"$HTTP_PROXY\";" > /etc/apt/apt.conf.d/99proxy) || true && \
([ -n "$HTTPS_PROXY" ] && echo "Acquire::https::Proxy \"$HTTPS_PROXY\";" >> /etc/apt/apt.conf.d/99proxy) || true && \
apt-get update && apt-get install -y --no-install-recommends \
wget curl ca-certificates gnupg software-properties-common && \ wget curl ca-certificates gnupg software-properties-common && \
# 添加 AMD ROCm 仓库 # 添加 AMD ROCm 仓库
wget -q https://repo.radeon.com/rocm/rocm.gpg.key -O - | \ wget -q https://repo.radeon.com/rocm/rocm.gpg.key -O - | \
+4
View File
@@ -9,6 +9,7 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
network: host # 构建时走宿主机网络(国内访问 ROCm 源需要)
args: args:
# ---- 按你的 GPU 修改 ---- # ---- 按你的 GPU 修改 ----
# gfx1201 = RX 9070 / 9070 XT / 9070 GRE # gfx1201 = RX 9070 / 9070 XT / 9070 GRE
@@ -17,6 +18,9 @@ services:
# gfx1101 = RX 7800 XT / 7700 XT # gfx1101 = RX 7800 XT / 7700 XT
# gfx1030 = RX 6950 / 6900 / 6800 系列 # gfx1030 = RX 6950 / 6900 / 6800 系列
ARCH: gfx1201 ARCH: gfx1201
# ---- 代理(国内必需)----
HTTP_PROXY: http://127.0.0.1:8118
HTTPS_PROXY: http://127.0.0.1:8118
container_name: mineru-rocm container_name: mineru-rocm
stdin_open: true stdin_open: true
tty: true tty: true