-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #133 from AirportR/dev
Dev
- Loading branch information
Showing
28 changed files
with
326 additions
and
150 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM python:3.9.18-slim-bookworm AS compile-image | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
gcc g++ make ca-certificates | ||
|
||
RUN python -m venv /opt/venv | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" | ||
ADD https://raw.githubusercontent.com/AirportR/FullTclash/dev/requirements.txt . | ||
RUN pip3 install --no-cache-dir -r requirements.txt && \ | ||
pip3 install --no-cache-dir supervisor | ||
|
||
FROM python:3.9.18-slim-bookworm | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && \ | ||
apt-get install --no-install-recommends -y \ | ||
git tzdata curl wget jq bash nano cron && \ | ||
git clone -b dev --single-branch --depth=1 https://github.com/AirportR/FullTclash.git /app && \ | ||
cp resources/config.yaml.example resources/config.yaml && \ | ||
rm -f /etc/localtime && \ | ||
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | ||
echo "Asia/Shanghai" > /etc/timezone && \ | ||
mkdir /etc/supervisord.d && \ | ||
mv /app/docker/supervisord.conf /etc/supervisord.conf && \ | ||
mv /app/docker/fulltclash.conf /etc/supervisord.d/fulltclash.conf && \ | ||
chmod +x /app/docker/fulltcore.sh && \ | ||
/app/docker/fulltcore.sh && \ | ||
cp /app/docker/crontab /etc/cron.d/crontab && \ | ||
chmod 0644 /etc/cron.d/crontab && \ | ||
/usr/bin/crontab /etc/cron.d/crontab && \ | ||
chmod +x /app/docker/update.sh && \ | ||
chmod +x /app/docker/docker-entrypoint.sh && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=compile-image /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=compile-image /opt/venv /opt/venv | ||
|
||
ENV PATH="/opt/venv/bin:$PATH" | ||
|
||
ENTRYPOINT ["/app/docker/docker-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# 使用Docker安装 | ||
|
||
> 这能让你在Windows、Mac、Linux、openwrt、Nas几乎任何支持Docker(目前仅Amd64和Arm64)的环境下使用此项目! | ||
## 1.创建配置文件 | ||
新建配置文件保存目录`mkdir /etc/FullTclash` | ||
下载并编辑配置文件 | ||
``` | ||
wget -O /etc/FullTclash/config.yaml https://raw.githubusercontent.com/AirportR/FullTclash/dev/resources/config.yaml.example | ||
``` | ||
修改 config.yaml (path是必须修改的配置,不能使用默认的) | ||
``` | ||
clash: | ||
path: './bin/fulltclash-origin' | ||
branch: origin | ||
``` | ||
或者 [Meta内核](https://github.com/AirportR/FullTCore/tree/meta) | ||
``` | ||
clash: | ||
path: './bin/fulltclash-meta' | ||
branch: meta | ||
``` | ||
|
||
## 构建Docker镜像 | ||
|
||
### 下载Dockerfile | ||
``` | ||
wget -N https://raw.githubusercontent.com/AirportR/FullTclash/dev/docker/Dockerfile | ||
``` | ||
|
||
### 构建镜像 | ||
``` | ||
docker build -t fulltclash:dev . | ||
``` | ||
|
||
启动 | ||
``` | ||
docker run -itd --name=fulltclash --restart=always -v /etc/FullTclash/config.yaml:/app/resources/config.yaml fulltclash:dev | ||
``` | ||
查看日志 | ||
``` | ||
docker exec -it fulltclash tail -f /var/log/fulltclash.log | ||
``` | ||
更新版本 | ||
``` | ||
docker exec -it fulltclash bash /app/docker/update.sh | ||
``` | ||
重启程序 | ||
``` | ||
docker exec -it fulltclash supervisorctl restart fulltclash | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
00 6 * * * bash /app/docker/update.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
supervisord -c /etc/supervisord.conf | ||
|
||
cron -f > /dev/null 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[program:fulltclash] | ||
command=python3 /app/main.py | ||
directory=/app | ||
stdout_logfile=/var/log/fulltclash.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
rm -f /app/bin/* | ||
|
||
ORIGIN_AMD64_URL=https://github.com/AirportR/FullTCore/releases/download/v1.0/FullTCore_1.0_linux_amd64.tar.gz | ||
META_AMD64_URL=https://github.com/AirportR/FullTCore/releases/download/v1.1-meta/FullTCore_1.1-meta_linux_amd64.tar.gz | ||
ORIGIN_ARM64_URL=https://github.com/AirportR/FullTCore/releases/download/v1.0/FullTCore_1.0_linux_arm64.tar.gz | ||
META_ARM64_URL=https://github.com/AirportR/FullTCore/releases/download/v1.1-meta/FullTCore_1.1-meta_linux_arm64.tar.gz | ||
|
||
arch=$(arch) | ||
|
||
if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then | ||
arch="amd64" | ||
wget -O /app/bin/FullTCore_origin.tar.gz ${ORIGIN_AMD64_URL} > /dev/null 2>&1 | ||
wget -O /app/bin/FullTCore_meta.tar.gz ${META_AMD64_URL} > /dev/null 2>&1 | ||
elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then | ||
arch="arm64" | ||
wget -O /app/bin/FullTCore_origin.tar.gz ${ORIGIN_ARM64_URL} > /dev/null 2>&1 | ||
wget -O /app/bin/FullTCore_meta.tar.gz ${META_ARM64_URL} > /dev/null 2>&1 | ||
fi | ||
|
||
tar -C /app/bin/ -xvzf /app/bin/FullTCore_origin.tar.gz | ||
mv /app/bin/FullTCore /app/bin/fulltclash-origin | ||
|
||
tar -C /app/bin/ -xvzf /app/bin/FullTCore_meta.tar.gz | ||
mv /app/bin/FullTCore /app/bin/fulltclash-meta | ||
|
||
find /app/bin/* | egrep -v "fulltclash-origin|fulltclash-meta" | xargs rm -f | ||
|
||
chmod +x /app/bin/fulltclash-origin | ||
chmod +x /app/bin/fulltclash-meta | ||
|
||
echo "架构: ${arch}下载FullTCore完成" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[unix_http_server] | ||
file=/tmp/supervisor.sock | ||
|
||
[supervisord] | ||
logfile=/tmp/supervisord.log | ||
logfile_maxbytes=50MB | ||
logfile_backups=10 | ||
loglevel=info | ||
pidfile=/tmp/supervisord.pid | ||
nodaemon=false | ||
silent=false | ||
minfds=1024 | ||
minprocs=200 | ||
|
||
[supervisorctl] | ||
serverurl=unix:///tmp/supervisor.sock | ||
|
||
[rpcinterface:supervisor] | ||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | ||
|
||
[include] | ||
files = supervisord.d/*.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
git_version=$(git --git-dir='/app/.git' --work-tree='/app' rev-parse HEAD) | ||
last_version=$(curl -Ls "https://api.github.com/repos/AirportR/FullTclash/commits/dev" | jq .sha | sed -E 's/.*"([^"]+)".*/\1/') | ||
|
||
update() { | ||
git --git-dir='/app/.git' --work-tree='/app' fetch --all | ||
git --git-dir='/app/.git' --work-tree='/app' reset --hard origin/dev | ||
git --git-dir='/app/.git' --work-tree='/app' pull | ||
} | ||
|
||
if [[ $last_version == "$git_version" ]]; then | ||
echo -e "已是最新版本,无需更新" | ||
else | ||
echo -e "检查到新版本,正在更新" | ||
update | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.