From 554ac3b8ba8ddceeb2a6453ef5bd99710f560d33 Mon Sep 17 00:00:00 2001 From: SZCJW <792430652@qq.com> Date: Tue, 17 Mar 2026 00:31:25 +0800 Subject: [PATCH] x --- Dockerfile | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index f5636b2..8b352a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,14 +23,11 @@ RUN if [ -n "$SOCKS_PROXY" ]; then \ HOST=$(echo $SOCKS_PROXY | cut -d: -f1); \ PORT=$(echo $SOCKS_PROXY | cut -d: -f2); \ sed -i "s/socks5.*/socks5 $HOST $PORT/g" /etc/proxychains.conf; \ - else \ - # If no proxy, remove the hardcoded one to avoid proxychains errors - sed -i "s/^socks5.*/# socks5 127.0.0.1 9050/g" /etc/proxychains.conf; \ fi # Define a proxy wrapper RUN echo '#!/bin/bash' > /usr/local/bin/maybe_proxy && \ - echo 'if grep -q "^socks5 [0-9]" /etc/proxychains.conf; then proxychains "$@"; else "$@"; fi' >> /usr/local/bin/maybe_proxy && \ + echo 'if grep -q "^socks5 [0-9]" /etc/proxychains.conf; then if command -v proxychains4 >/dev/null 2>&1; then proxychains4 "$@"; else proxychains "$@"; fi; else "$@"; fi' >> /usr/local/bin/maybe_proxy && \ chmod +x /usr/local/bin/maybe_proxy # 1. System Base & Build Tools @@ -109,14 +106,31 @@ ENV HIP_PATH="/opt/rocm" ENV PATH="/opt/rocm/bin:/opt/rocm/llvm/bin:$PATH" ENV LD_LIBRARY_PATH="/opt/rocm/lib:/opt/rocm/lib64:/opt/rocm/llvm/lib" -RUN if [ -n "$SOCKS_PROXY" ]; then \ - git config --global http.proxy "socks5://$SOCKS_PROXY" && \ - git config --global https.proxy "socks5://$SOCKS_PROXY"; \ - fi && \ - git clone --recursive https://github.com/ROCm/flash-attention.git && \ - cd flash-attention && \ - git checkout main_perf && \ - python setup.py install && \ +RUN set -euo pipefail; \ + git config --global http.postBuffer 524288000; \ + git config --global http.lowSpeedLimit 0; \ + git config --global http.lowSpeedTime 999999; \ + git config --global http.version HTTP/1.1; \ + if [ -n "$SOCKS_PROXY" ]; then \ + git config --global http.proxy "socks5://$SOCKS_PROXY"; \ + git config --global https.proxy "socks5://$SOCKS_PROXY"; \ + fi; \ + CLONED=0; \ + for i in 1 2 3 4 5; do \ + rm -rf /opt/flash-attention; \ + if maybe_proxy git clone --recursive --branch main_perf --depth 1 --shallow-submodules https://github.com/ROCm/flash-attention.git /opt/flash-attention; then \ + CLONED=1; \ + break; \ + fi; \ + echo "flash-attention clone failed (attempt ${i}/5), retrying..."; \ + sleep $((i * 5)); \ + done; \ + if [ "${CLONED}" -ne 1 ]; then \ + echo "flash-attention clone failed after retries"; \ + exit 1; \ + fi; \ + cd /opt/flash-attention; \ + python setup.py install; \ cd /opt && rm -rf /opt/flash-attention # 6. Clone vLLM