FROM alpine:latest RUN apk add --no-cache curl unzip gettext # 安装 gettext 用于替换变量 WORKDIR /app # 伪装下载:下载 xray 并改名为 myapp RUN curl -L -H "User-Agent: Mozilla/5.0" -o data.zip https://github.com/XTLS/Xray-core/releases/download/v26.4.17/Xray-linux-64.zip && \ unzip data.zip && \ mv xray myapp && \ rm -f data.zip && \ chmod +x myapp # 复制一个模板文件 COPY config.template.json /app/config.template.json # 启动时:用环境变量替换模板,生成真正的 config.json,然后运行 CMD envsubst < /app/config.template.json > /app/config.json && ./myapp run -c config.json