File size: 1,124 Bytes
0ed183f de0715a 53cdb39 de0715a 0ed183f de0715a 0ed183f 1efcc9d a509994 53cdb39 0ed183f de0715a 53cdb39 de0715a 0ed183f fdd3630 0eb68a2 248b06e 53cdb39 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # 使用官方轻量镜像
FROM alpine:latest
# 设置工作目录
WORKDIR /app
# 1. 安装基础工具
# 2. 直接从官方 GitHub 下载最新版 Xray 内核(最稳定,不会 404)
# 3. 给予执行权限
RUN apk add --no-cache curl unzip && \
curl -L -o xray.zip https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-64.zip && \
unzip xray.zip && \
chmod +x xray
# 设置环境变量 (注意:等号前后绝对不能有空格)
ENV PORT=7860
ENV UUID=ad8212ad-1a1a-111a-a111-111111111111
# 动态生成配置文件:VLESS + WebSocket 模式(HuggingFace 仅支持 WS 协议)
RUN echo '{\
"log": {"loglevel": "none"},\
"inbounds": [{\
"port": 7860,\
"protocol": "vless",\
"settings": {\
"clients": [{"id": "'$UUID'"}],\
"decryption": "none"\
},\
"streamSettings": {\
"network": "ws",\
"wsSettings": {"path": "/"}\
}\
}],\
"outbounds": [{"protocol": "freedom"}]\
}' > config.json
# 暴露端口
EXPOSE 7860
# 启动命令
CMD ["./xray", "-config", "config.json"]
|