Skip to content

Commit

Permalink
Sing-box + Argo container is newly launched.
Browse files Browse the repository at this point in the history
  • Loading branch information
fscarmen committed Apr 1, 2024
1 parent d08cf4d commit edb022a
Show file tree
Hide file tree
Showing 5 changed files with 1,368 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Build and push images"

on:
workflow_dispatch:

jobs:
Build:
runs-on: ubuntu-latest
name: "Build Sing-box image"
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKERHUB_REPOSITORY: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }}:latest

steps:
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Push images to Docker hub
uses: docker/[email protected]
with:
push: true
platforms: linux/amd64, linux/arm64, linux/arm/v7
tags: ${{ env.DOCKERHUB_REPOSITORY }}
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 第一个阶段:使用 OpenSSL 生成证书文件
FROM alpine/openssl:latest AS openssl

# 生成私钥和证书
RUN openssl ecparam -genkey -name prime256v1 -out /private.key && \
openssl req -new -x509 -days 36500 -key /private.key -out /cert.pem -subj "/CN=mozilla.org"

# 第二个阶段:使用 Alpine 镜像并复制证书文件
FROM alpine:latest
ARG TARGETARCH
ENV ARCH=$TARGETARCH

# 设置工作目录
WORKDIR /sing-box

# 从第一个阶段的 OpenSSL 镜像中复制证书文件到当前镜像
COPY --from=openssl /private.key /sing-box/cert/private.key
COPY --from=openssl /cert.pem /sing-box/cert/cert.pem
COPY docker_init.sh /sing-box/init.sh

RUN set -ex &&\
apk add --no-cache supervisor nginx bash &&\
mkdir -p /sing-box/conf /sing-box/subscribe /sing-box/logs &&\
chmod +x /sing-box/init.sh &&\
rm -rf /var/cache/apk/*

CMD [ "./init.sh" ]
122 changes: 121 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
- [项目特点](README.md#项目特点)
- [Sing-box for VPS 运行脚本](README.md#sing-box-for-vps-运行脚本)
- [无交互极速安装](README.md#无交互极速安装)
- [Vmess / Vless 方案设置任意端口回源以使用 cdn](README.md#Vmess--Vless-方案设置任意端口回源以使用-cdn)
- [Vmess / Vless 方案设置任意端口回源以使用 cdn](README.md#vmess--lless-方案设置任意端口回源以使用-cdn)
- [Docker 和 Docker compose 安装](README.md#docker-和-docker-compose-安装)
- [Nekobox 设置 shadowTLS 方法](README.md#nekobox-设置-shadowtls-方法)
- [主体目录文件及说明](README.md#主体目录文件及说明)
- [鸣谢下列作者的文章和项目](README.md#鸣谢下列作者的文章和项目)
Expand All @@ -17,6 +18,8 @@

* * *
## 更新信息
2024.04.01 sing-box + argo container version is newly launched, for details: https://github.com/fscarmen/sing-box/blob/main/README.md; sing-box 全家桶 + argo 容器版本全新上线,详细参考: https://github.com/fscarmen/sing-box/blob/main/README.md

2024.03.27 v1.1.11 Add two non-interactive installation modes: 1. pass parameter; 2.kv file, for details: https://github.com/fscarmen/sing-box/blob/main/README.md; 增加两个的无交互安装模式: 1. 传参;2.kv 文件,详细参考: https://github.com/fscarmen/sing-box/blob/main/README.md

2024.03.26 v1.1.10 Thanks to UUb for the official change of the compilation, dependencies jq, qrencode from apt installation to download the binary file, reduce the installation time of about 15 seconds, the implementation of the project's positioning of lightweight, as far as possible to install the least system dependencies; 感谢 UUb 兄弟的官改编译,依赖 jq, qrencode 从 apt 安装改为下载二进制文件,缩减安装时间约15秒,贯彻项目轻量化的定位,尽最大可能安装最少的系统依赖
Expand Down Expand Up @@ -79,8 +82,14 @@

## Sing-box for VPS 运行脚本:

* 首次运行
```
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-box.sh)
```

* 再次运行
```
sb
```

| Option 参数 | Remark 备注 |
Expand Down Expand Up @@ -143,6 +152,117 @@ bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-b
<img width="1556" alt="image" src="https://github.com/fscarmen/sing-box/assets/62703343/164bf255-a6be-40bc-a724-56e13da7a1e6">


## Docker 和 Docker compose 安装

### 说明:
* 支持三种 Argo 类型隧道: 临时 (不需要域名) / Json / Token
* 需要20个连续可用的端口,以 `START_PORT` 开始第一个


### 用户可以通过 Cloudflare Json 生成网轻松获取: https://fscarmen.cloudflare.now.cc

<img width="784" alt="image" src="https://github.com/fscarmen/sba/assets/62703343/fb7c6e90-fb3e-4e77-bcd4-407e4660a33c">

如想手动,可以参考,以 Debian 为例,需要用到的命令,[Deron Cheng - CloudFlare Argo Tunnel 试用](https://zhengweidong.com/try-cloudflare-argo-tunnel)


### Argo Token 的获取

详细教程: [群晖套件:Cloudflare Tunnel 内网穿透中文教程 支持DSM6、7](https://imnks.com/5984.html)

<img width="1510" alt="image" src="https://github.com/fscarmen/sba/assets/62703343/bb2d9c43-3585-4abd-a35b-9cfd7404c87c">

<img width="1616" alt="image" src="https://github.com/fscarmen/sing-box/assets/62703343/ecb844be-1e93-4208-bb7c-6b00b9d1f00a">

### Docker 部署

```
docker run -dit \
--pull always \
--name sing-box
-p 8800-8820:8800-8820/tcp \
-p 8800-8820:8800-8820/udp \
-e START_PORT=8800 \
-e SERVER_IP=123.123.123.123 \
-e XTLS_REALITY=true \
-e HYSTERIA2=true \
-e TUIC=true \
-e SHADOWTLS=true \
-e SHADOWSOCKS=true \
-e TROJAN=true \
-e VMESS_WS=true \
-e VLESS_WS=true \
-e H2_REALITY=true \
-e GRPC_REALITY=true \
-e UUID=68fe8d27-cbc8-4e72-90b7-70d3bb69dfd3 \
-e CDN=www.csgo.com \
-e NODE_NAME=sing-box \
-e ARGO_DOMAIN=sb.argo.com \
-e ARGO_AUTH='{"AccountTag":"9cc9e3e4d8f29d2a02e297f14f20513a","TunnelSecret":"6AYfKBOoNlPiTAuWg64ZwujsNuERpWLm6pPJ2qpN8PM=","TunnelID":"1ac55430-f4dc-47d5-a850-bdce824c4101"}' \
fscarmen/sb
```


### Docker Compose 部署
```
version: '3.8'
services:
sing-box:
image: fscarmen/sb
pull_policy: always
container_name: sing-box
restart: always
ports:
- "8000-8020:8800-8820/tcp"
- "8000-8020:8800-8820/udp"
environment:
- START_PORT=8800
- SERVER_IP=123.123.123.123
- XTLS_REALITY=true
- HYSTERIA2=true
- TUIC=true
- SHADOWTLS=true
- SHADOWSOCKS=true
- TROJAN=true
- VMESS_WS=true
- VLESS_WS=true
- H2_REALITY=true
- GRPC_REALITY=true
- UUID=68fe8d27-cbc8-4e72-90b7-70d3bb69dfd3
- CDN=www.csgo.com
- NODE_NAME=sing-box
- ARGO_DOMAIN=sb.argo.com
- ARGO_AUTH=eyJhIjoiOWNjOWUzZTRkOGYyOWQyYTAyZTI5N2YxNGYyMDUxM2EiLCJ0IjoiOGNiZDA4ZjItNGM0MC00OGY1LTlmZDYtZjlmMWQ0YTcxMjUyIiwicyI6IllXWTFORGN4TW1ZdE5HTXdZUzAwT0RaakxUbGxNMkl0Wm1VMk5URTFOR0l4TkdKayJ9
```

### 更新 Sing-box 版本
```
docker exec -it sing-box bash init.sh -v
```

### 参数说明
| 参数 | 是否必须 | 说明 |
| --- | ------- | --- |
| -p /tcp || 宿主机端口范围:容器 sing-box 及 nginx 等 tcp 监听端口 |
| -p /udp || 宿主机端口范围:容器 sing-box 及 nginx 等 udp 监听端口 |
| -e START_PORT || 起始端口 ,一定要与端口映射的起始端口一致 |
| -e SERVER_IP || 服务器公网 IP |
| -e XTLS_REALITY || true 为启用 XTLS + reality,不需要的话删除本参数或填 false |
| -e HYSTERIA2 || true 为启用 Hysteria v2 协议,不需要的话删除本参数或填 false |
| -e TUIC || true 为启用 TUIC 协议,不需要的话删除本参数或填 false |
| -e SHADOWTLS || true 为启用 ShadowTLS 协议,不需要的话删除本参数或填 false |
| -e SHADOWSOCKS || true 为启用 ShadowSocks 协议,不需要的话删除本参数或填 false |
| -e TROJAN || true 为启用 Trojan 协议,不需要的话删除本参数或填 false |
| -e VMESS_WS || true 为启用 VMess over WebSocket 协议,不需要的话删除本参数或填 false |
| -e VLESS_WS || true 为启用 VLess over WebSocket 协议,不需要的话删除本参数或填 false |
| -e H2_REALITY || true 为启用 H2 over reality 协议,不需要的话删除本参数或填 false |
| -e GRPC_REALITY || true 为启用 gRPC over reality 协议,不需要的话删除本参数或填 false |
| -e UUID || 不指定的话 UUID 将默认随机生成 |
| -e CDN || 优选域名,不指定的话将使用 www.csgo.com |
| -e NODE_NAME || 节点名称,不指定的话将使用 sing-box |
| -e ARGO_DOMAIN || Argo 固定隧道域名 , 与 ARGO_DOMAIN 一并使用才能生效 |
| -e ARGO_AUTH || Argo 认证信息,可以是 Json 也可以是 Token,与 ARGO_DOMAIN 一并使用才能生效,不指定的话将使用临时隧道 |

## Nekobox 设置 shadowTLS 方法
1. 复制脚本输出的两个 Neko links 进去
<img width="630" alt="image" src="https://github.com/fscarmen/sing-box/assets/62703343/db5960f3-63b1-4145-90a5-b01066dd39be">
Expand Down
Loading

0 comments on commit edb022a

Please sign in to comment.