Skip to content

Commit

Permalink
debug clash auto start
Browse files Browse the repository at this point in the history
  • Loading branch information
haobibo committed Nov 22, 2024
1 parent e456f7c commit 1c267db
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
7 changes: 5 additions & 2 deletions docker_app_clash/clash.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ 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
&& mv /opt/utils/config.yaml /opt/clash/config \
&& mv /opt/utils/start-clash.sh /opt/clash/


# Stage 2: runtime image, copy files from builder image
Expand All @@ -21,7 +22,9 @@ FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG}
COPY --from=builder /opt/clash /opt/clash
WORKDIR /opt/clash
RUN set -eux \
&& chmod +x /opt/clash/*.sh \
&& 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"]
ENV PROXY_PROVIDER="https://subs.zeabur.app/clash"
CMD ["/opt/clash/start-clash.sh"]
2 changes: 2 additions & 0 deletions docker_app_clash/demo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ services:
- "9090:9090"
volumes:
- ../work/clash/config.yaml:/opt/clash/config/config.yaml:ro
environment:
- PROXY_PROVIDER="https://subs.zeabur.app/clash"
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 @@ -32,7 +32,7 @@ use: &use
proxy-providers:
proxy-provider-1:
<<: *p
url: https://your.subscription.com/should-be-filled-here
url: "PROXY_PROVIDER" # e.g.: https://your.subscription.com/should-be-filled-here


# ------------------------- rule provider config -------------------------
Expand Down
9 changes: 9 additions & 0 deletions docker_app_clash/work/clash/start-clash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/env bash
set -eux

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

echo "Setting PROXY_PROVIDER to: ${PROXY_PROVIDER}!"
sed -i -e "s/PROXY_PROVIDER/${PROXY_PROVIDER}/g" ${CLASH_CONFIG_PATH:-"/opt/clash/config/config.yml"}

exec /opt/clash/clash -d config $@
2 changes: 2 additions & 0 deletions docker_searxng/demo/docker-compose.searxng-with-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ services:
- "9090:9090"
volumes:
- ./clash/config.yaml:/opt/clash/config/config.yaml:ro
environment:
- PROXY_PROVIDER="https://subs.zeabur.app/clash"

0 comments on commit 1c267db

Please sign in to comment.