FROM alpine:latest # 设置工作目录 WORKDIR /app # 安装必要的工具 RUN apk add --no-cache curl unzip # 下载 Xray (以 1.8.4 为例,可自选版本) RUN curl -L -H "Cache-Control: no-cache" -o xray.zip https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-64.zip && \ unzip xray.zip && \ chmod +x xray # 创建简易启动脚本 RUN echo '#!/bin/sh' > entrypoint.sh && \ echo 'cat < config.json' >> entrypoint.sh && \ echo '{ "inbounds": [{ "port": 7860, "protocol": "vless", "settings": { "clients": [{ "id": "$UUID", "level": 0 }], "decryption": "none" }, "streamSettings": { "network": "ws", "wsSettings": { "path": "$WSPATH" } } }], "outbounds": [{ "protocol": "freedom" }] }' >> entrypoint.sh && \ echo 'EOF' >> entrypoint.sh && \ echo './xray -config config.json' >> entrypoint.sh && \ chmod +x entrypoint.sh # Hugging Face 默认监听 7860 端口 EXPOSE 7860 CMD ["./entrypoint.sh"]