This commit is contained in:
2026-03-17 00:31:25 +08:00
parent 3255c5adb3
commit 554ac3b8ba
+25 -11
View File
@@ -23,14 +23,11 @@ RUN if [ -n "$SOCKS_PROXY" ]; then \
HOST=$(echo $SOCKS_PROXY | cut -d: -f1); \ HOST=$(echo $SOCKS_PROXY | cut -d: -f1); \
PORT=$(echo $SOCKS_PROXY | cut -d: -f2); \ PORT=$(echo $SOCKS_PROXY | cut -d: -f2); \
sed -i "s/socks5.*/socks5 $HOST $PORT/g" /etc/proxychains.conf; \ 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 fi
# Define a proxy wrapper # Define a proxy wrapper
RUN echo '#!/bin/bash' > /usr/local/bin/maybe_proxy && \ 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 chmod +x /usr/local/bin/maybe_proxy
# 1. System Base & Build Tools # 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 PATH="/opt/rocm/bin:/opt/rocm/llvm/bin:$PATH"
ENV LD_LIBRARY_PATH="/opt/rocm/lib:/opt/rocm/lib64:/opt/rocm/llvm/lib" ENV LD_LIBRARY_PATH="/opt/rocm/lib:/opt/rocm/lib64:/opt/rocm/llvm/lib"
RUN if [ -n "$SOCKS_PROXY" ]; then \ RUN set -euo pipefail; \
git config --global http.proxy "socks5://$SOCKS_PROXY" && \ 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"; \ git config --global https.proxy "socks5://$SOCKS_PROXY"; \
fi && \ fi; \
git clone --recursive https://github.com/ROCm/flash-attention.git && \ CLONED=0; \
cd flash-attention && \ for i in 1 2 3 4 5; do \
git checkout main_perf && \ rm -rf /opt/flash-attention; \
python setup.py install && \ 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 cd /opt && rm -rf /opt/flash-attention
# 6. Clone vLLM # 6. Clone vLLM