[fix] 更正 README.MD 错误
[update]  Dockerfile alpine 版本调整
[fix]  entrypoint.sh 逻辑修正
This commit is contained in:
wulabing 2023-03-17 12:47:50 +08:00
parent 1812cba147
commit a4602771cb
No known key found for this signature in database
GPG Key ID: 213391AFDF73AE00
4 changed files with 38 additions and 34 deletions

View File

@ -11,7 +11,7 @@ RUN apk add --no-cache git && git clone https://github.com/XTLS/Xray-core.git .
go build -o xray /app/main/
# runner
FROM alpine:3.17 as runner
FROM alpine:latest as runner
ENV UUID=""

View File

@ -12,7 +12,7 @@ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
```
ocker run -d --name xray_reality -p 443:443 wulabing/xray_docker_reality:0.0.1
docker run -d --name xray_reality --restart=always -p 443:443 wulabing/xray_docker_reality:0.0.1
```
查看日志获取配置信息

1
reality/SERVERNAMES.MD Normal file
View File

@ -0,0 +1 @@
## 已知可用的 SERVERNAMES 及 DEST 列表

View File

@ -1,5 +1,8 @@
#!/bin/sh
if [ -f /config_info.txt ]; then
echo "config.json exist"
cat /config_info.txt
else
if [ -z "$UUID" ]; then
echo "UUID is not set, generate random UUID "
UUID="$(uuidgen)"
@ -30,7 +33,6 @@ if [ -z "$NETWORK" ]; then
echo "NETWORK is not set,set default value tcp"
NETWORK="tcp"
fi
# change config
jq ".inbounds[0].settings.clients[0].id=\"$UUID\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
jq ".inbounds[0].streamSettings.realitySettings.dest=\"$DEST\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
@ -40,16 +42,17 @@ jq --argjson serverNames "$SERVERNAMES_JSON_ARRAY" '.inbounds[0].streamSettings.
jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$PRIVATEKEY\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
jq ".inbounds[0].streamSettings.network=\"$NETWORK\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
fi
# config info with green color
echo -e "\033[32m"
echo "UUID: $UUID"
echo "DEST: $DEST"
echo "SERVERNAMES: $SERVERNAMES (任选其一)"
echo "PRIVATEKEY: $PRIVATEKEY"
echo "PUBLICKEY: $PUBLICKEY"
echo "NETWORK: $NETWORK"
echo -e "\033[0m"
echo -e "\033[32m" >/config_info.txt
echo "UUID: $UUID" >>/config_info.txt
echo "DEST: $DEST" >>/config_info.txt
echo "SERVERNAMES: $SERVERNAMES (任选其一)" >>/config_info.txt
echo "PRIVATEKEY: $PRIVATEKEY" >>/config_info.txt
echo "PUBLICKEY: $PUBLICKEY" >>/config_info.txt
echo "NETWORK: $NETWORK" >>/config_info.txt
echo -e "\033[0m" >>/config_info.txt
# run xray
/xray -config /config.json
exec /xray -config /config.json