-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into dev
- Loading branch information
Showing
9 changed files
with
181 additions
and
54 deletions.
There are no files selected for viewing
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,49 @@ | ||
name: build_meta_image | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'docker/Metafile' | ||
- 'docker/Metafile.alpine' | ||
- 'requirements.txt' | ||
branches: | ||
- "dev" | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set Environment Variables | ||
run: | | ||
IMG=fulltclash | ||
echo "IMG=${IMG}" >> $GITHUB_ENV | ||
echo "IMAGE=${{ secrets.DOCKERHUB_USERNAME }}/${IMG}" >> $GITHUB_ENV | ||
- name: Build Debian Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./docker/Metafile | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
${{ env.IMAGE }}:debian | ||
- name: Build Alpine Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./docker/Metafile.alpine | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
${{ env.IMAGE }}:alpine |
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,19 @@ | ||
FROM python:3.11.7-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.11.7-slim-bookworm | ||
|
||
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" |
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,18 @@ | ||
FROM python:3.11.7-alpine3.19 AS compile-image | ||
|
||
RUN apk add --no-cache \ | ||
gcc g++ make libffi-dev libstdc++ gcompat libgcc build-base py3-pybind11-dev abseil-cpp-dev re2-dev 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.11.7-alpine3.19 | ||
|
||
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" |
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 |
---|---|---|
@@ -1,19 +1,38 @@ | ||
#!/bin/bash | ||
. /etc/profile | ||
|
||
git_branch=$(git --git-dir='/app/.git' --work-tree='/app' rev-parse --abbrev-ref HEAD) | ||
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/') | ||
|
||
if [[ master == "$git_branch" ]]; then | ||
echo -e "当前分支为 $git_branch" | ||
echo -e "当前commits位于 $git_version" | ||
last_version=$(curl -Ls "https://api.github.com/repos/AirportR/FullTclash/commits/master" | jq .sha | sed -E 's/.*"([^"]+)".*/\1/') | ||
elif [[ dev == "$git_branch" ]]; then | ||
echo -e "当前分支为 $git_branch" | ||
echo -e "当前commits位于 $git_version" | ||
last_version=$(curl -Ls "https://api.github.com/repos/AirportR/FullTclash/commits/dev" | jq .sha | sed -E 's/.*"([^"]+)".*/\1/') | ||
elif [[ backend == "$git_branch" ]]; then | ||
echo -e "当前分支为 $git_branch" | ||
echo -e "当前commits位于 $git_version" | ||
last_version=$(curl -Ls "https://api.github.com/repos/AirportR/FullTclash/commits/backend" | jq .sha | sed -E 's/.*"([^"]+)".*/\1/') | ||
else | ||
echo -e "暂不支持此分支" | ||
exit 1 | ||
fi | ||
|
||
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' reset --hard origin/$git_branch | ||
git --git-dir='/app/.git' --work-tree='/app' pull | ||
git_version=$(git --git-dir='/app/.git' --work-tree='/app' rev-parse HEAD) | ||
} | ||
|
||
if [[ $last_version == "$git_version" ]]; then | ||
echo -e "已是最新版本,无需更新" | ||
else | ||
echo -e "检查到新版本,正在更新" | ||
update | ||
echo -e "更新完成,当前commits位于 $git_version" | ||
/opt/venv/bin/supervisorctl restart fulltclash | ||
fi |