Skip to content

Commit

Permalink
update ui build
Browse files Browse the repository at this point in the history
  • Loading branch information
haobibo committed Jun 22, 2024
1 parent e989da2 commit b32eec0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docker_app_clash/clash.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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_verge \
&& setup_clash && setup_clash_metacubexd && setup_clash_verge \
&& mv /opt/utils/config.yaml /opt/clash/config


Expand Down
2 changes: 1 addition & 1 deletion docker_app_clash/work/clash/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
mixed-port: 57890

external-controller: 0.0.0.0:59090
external-ui: /opt/clash/ui
external-ui: /opt/clash/ui-xd
external-ui-name: xd
external-ui-url: "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip"

Expand Down
15 changes: 13 additions & 2 deletions docker_app_clash/work/clash/script-setup-clash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,18 @@ setup_clash() {
&& wget -O /opt/clash/config/geoip.dat https://fastly.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat
}

setup_verge() {
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" \
Expand All @@ -30,5 +41,5 @@ setup_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
&& mv /tmp/verge/dist /opt/clash/ui-verge
}

0 comments on commit b32eec0

Please sign in to comment.