-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update clash * fix clash config ui * update entrypoint * update clash README
- Loading branch information
Showing
7 changed files
with
93 additions
and
21 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Clash / Mihomo | ||
|
||
- mihomo core: https://github.com/MetaCubeX/mihomo/tree/Alpha | ||
- webui matacubexd: https://github.com/MetaCubeX/metacubexd | ||
- webui verge / client: https://clash-verge-rev.github.io | ||
|
||
## Usage | ||
|
||
```shell | ||
docker run -d --name=app-clash -p 57890:57890 -p 59090:59090 qpod/app-clash | ||
``` |
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,27 @@ | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
ARG BASE_NAMESPACE | ||
ARG BASE_IMG_BUILD="go-stack" | ||
ARG BASE_IMG="atom" | ||
|
||
|
||
# Stage 1: build code, both backend and frontend | ||
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG_BUILD} as builder | ||
|
||
COPY work/clash /opt/utils/ | ||
|
||
RUN set -eux && source /opt/utils/script-setup-clash.sh \ | ||
&& setup_clash && setup_clash_metacubexd && setup_clash_verge \ | ||
&& mv /opt/utils/config.yaml /opt/clash/config | ||
|
||
|
||
# Stage 2: runtime image, copy files from builder image | ||
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} | ||
|
||
COPY --from=builder /opt/clash /opt/clash | ||
WORKDIR /opt/clash | ||
RUN set -eux \ | ||
&& echo 'export PATH=${PATH}:/opt/clash' >> /etc/profile.d/path-clash.sh \ | ||
&& ln -sf /opt/clash/clash /usr/local/bin/ | ||
|
||
CMD ["/opt/clash/clash", "-d", "config"] |
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
11 changes: 8 additions & 3 deletions
11
docker_app_clash/demo/config.yaml → docker_app_clash/work/clash/config.yaml
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,45 @@ | ||
source /opt/utils/script-utils.sh | ||
|
||
setup_clash() { | ||
# Install the latest release: https://github.com/MetaCubeX/mihomo/tree/Alpha | ||
VER_CLASH=$(curl -sL https://github.com/MetaCubeX/mihomo/releases.atom | grep 'releases/tag/v' | head -1 | grep -Po '\d[\d.]+' ) \ | ||
&& URL_CLASH="https://github.com/MetaCubeX/mihomo/archive/refs/tags/v$VER_CLASH.tar.gz" \ | ||
&& echo "Downloading clash version ${VER_CLASH} from: ${URL_CLASH}" \ | ||
&& install_tar_gz $URL_CLASH \ | ||
&& mv /opt/mihomo-* /tmp/clash && cd /tmp/clash \ | ||
&& export BUILDTIME=$(date -u) \ | ||
&& export GOARCH=amd64 && export GOOS=linux && export GOAMD64=v3 && export CGO_ENABLED=0 \ | ||
&& opt='-X \"github.com/metacubex/mihomo/constant.Version=${VER_CLASH}\" -X \"github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}\" -w -s -buildid=1' \ | ||
&& opt=$(eval echo $opt) \ | ||
&& cmd="go build -tags with_gvisor -trimpath -o /opt/clash/clash -ldflags '${opt}'" \ | ||
&& eval $cmd && /opt/clash/clash -v \ | ||
&& echo "@ Version of Clash $(clash -v)" | ||
|
||
mkdir -pv /opt/clash/config \ | ||
&& wget -O /opt/clash/config/geoip.metadb https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.metadb \ | ||
&& wget -O /opt/clash/config/geosite.dat https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat \ | ||
&& wget -O /opt/clash/config/geoip.dat https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat | ||
} | ||
|
||
setup_clash_metacubexd() { | ||
# Install the latest release: https://github.com/MetaCubeX/metacubexd | ||
VER_XD=$(curl -sL https://github.com/MetaCubeX/metacubexd/releases.atom | grep 'releases/tag/v' | head -1 | grep -Po '\d[\d.]+' ) \ | ||
&& URL_XD="https://github.com/MetaCubeX/metacubexd/archive/refs/tags/v$VER_XD.tar.gz" \ | ||
&& echo "Downloading XD version ${VER_XD} from: ${URL_XD}" \ | ||
&& install_tar_gz $URL_XD \ | ||
&& mv /opt/metacubexd-* /tmp/xd && cd /tmp/xd \ | ||
&& npx pnpm i && npx pnpm run build && ls -alh \ | ||
&& mv /tmp/xd/dist /opt/clash/ui-xd | ||
} | ||
|
||
setup_clash_verge() { | ||
# Install the latest release: https://clash-verge-rev.github.io/index.html | ||
VER_VERGE=$(curl -sL https://github.com/clash-verge-rev/clash-verge-rev/releases.atom | grep 'releases/tag/v' | head -1 | grep -Po '\d[\d.]+' ) \ | ||
&& URL_VERGE="https://github.com/clash-verge-rev/clash-verge-rev/archive/refs/tags/v$VER_VERGE.tar.gz" \ | ||
&& echo "Downloading clash-verge version ${VER_VERGE} from: ${URL_VERGE}" \ | ||
&& install_tar_gz $URL_VERGE \ | ||
&& mv /opt/clash-verge-* /tmp/verge && cd /tmp/verge \ | ||
&& jq '.homepage = "./ui"' package.json > tmp.$$.json && mv tmp.$$.json package.json \ | ||
&& npx pnpm i && npx pnpm run web:build && ls -alh \ | ||
&& mv /tmp/verge/dist /opt/clash/ui-verge | ||
} |