[fix] entrypoint.sh 逻辑错误修正
[update] Dockerfile 内容完善
[update] README.MD 更新
[update] Github Action 逻辑调整
This commit is contained in:
wulabing 2023-03-17 16:40:58 +08:00
parent 987328d6df
commit 3993f9da1b
No known key found for this signature in database
GPG Key ID: 213391AFDF73AE00
5 changed files with 47 additions and 37 deletions

View File

@ -17,33 +17,34 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3.4.0 uses: actions/checkout@v3.4.0
- name: Docker Setup Buildx - name: Docker Setup Buildx
uses: docker/setup-buildx-action@v2.5.0 uses: docker/setup-buildx-action@v2.5.0
- name: Docker Login - name: Docker Login
uses: docker/login-action@v2.1.0 uses: docker/login-action@v2.1.0
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract first line of commit message - name: Extract first line of commit message
shell: bash shell: bash
run: | run: |
COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.sha }}) COMMIT_MESSAGE=$(git log --format=%B -n 1 ${{ github.sha }})
FIRST_LINE=$(echo "$COMMIT_MESSAGE" | head -n1) FIRST_LINE=$(echo "$COMMIT_MESSAGE" | head -n1)
TAG_NAME=$(echo "$FIRST_LINE" | tr -d '[:space:]') # Remove spaces if needed TAG_NAME=$(echo "$FIRST_LINE" | tr -d '[:space:]') # Remove spaces if needed
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
- name: Build the Docker image latest
run: docker build --file ./reality/Dockerfile --tag wulabing/xray_docker_reality:latest ./reality
- name: Build the Docker image - name: Build the Docker image
run: docker build --file ./reality/Dockerfile --tag wulabing/xray_docker_reality:${{env.TAG_NAME}} ./reality run: docker build --file ./reality/Dockerfile --tag wulabing/xray_docker_reality:${{env.TAG_NAME}} ./reality
- name: Push the Docker image latest - name: Build the Docker image latest
run: docker push wulabing/xray_docker_reality:latest run: docker build --file ./reality/Dockerfile --tag wulabing/xray_docker_reality:latest ./reality
- name: Push the Docker image
run: docker push wulabing/xray_docker_reality:${{env.TAG_NAME}} - name: Push the Docker image
run: docker push wulabing/xray_docker_reality:${{env.TAG_NAME}}
- name: Push the Docker image latest
run: docker push wulabing/xray_docker_reality:latest

View File

@ -24,7 +24,9 @@ ENV TZ=Asia/Shanghai
WORKDIR / WORKDIR /
COPY . / COPY ./entrypoint.sh /
COPY ./config.json /
COPY --from=builder /app/xray / COPY --from=builder /app/xray /
RUN apk add --no-cache tzdata ca-certificates util-linux jq && \ RUN apk add --no-cache tzdata ca-certificates util-linux jq && \

View File

@ -12,7 +12,7 @@ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
``` ```
docker run -d --name xray_reality --restart=always -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:latest
``` ```
查看日志获取配置信息 查看日志获取配置信息

View File

@ -1 +1,6 @@
## 已知可用的 SERVERNAMES 及 DEST 列表 ## 已知可用的 SERVERNAMES 及 DEST 列表
| DEST | SERVERMANES | 说明 |
|-------------------|--------------------------------|------------------------------------|
| www.apple.com:443 | images.apple.com www.apple.com | Apple 使用了 akamai CDN全球各地存在节点并且知名 |

View File

@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
if [ -f /config_info.txt ]; then if [ -f /config_info.txt ]; then
echo "config.json exist" echo "config.json exist"
cat /config_info.txt
else else
if [ -z "$UUID" ]; then if [ -z "$UUID" ]; then
echo "UUID is not set, generate random UUID " echo "UUID is not set, generate random UUID "
@ -42,17 +41,20 @@ else
jq ".inbounds[0].streamSettings.realitySettings.privateKey=\"$PRIVATEKEY\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json 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 jq ".inbounds[0].streamSettings.network=\"$NETWORK\"" /config.json >/config.json_tmp && mv /config.json_tmp /config.json
# config info with green color
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
fi fi
# config info with green color # show config info
echo -e "\033[32m" >/config_info.txt cat /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 # run xray
exec /xray -config /config.json exec /xray -config /config.json