diff options
author | Yuqian Yang <crupest@crupest.life> | 2025-03-09 17:31:21 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-03-09 18:46:54 +0800 |
commit | 05072cb766a6200e859a402258ccf1fde1b1adec (patch) | |
tree | 84ed1cd289998093a67738ca63c3f0979ffa6dda /services/docker/v2ray | |
parent | 8938b82cab915aeda90acd4112e82c692c295100 (diff) | |
download | crupest-05072cb766a6200e859a402258ccf1fde1b1adec.tar.gz crupest-05072cb766a6200e859a402258ccf1fde1b1adec.tar.bz2 crupest-05072cb766a6200e859a402258ccf1fde1b1adec.zip |
feat(service): mv config to docker imagei, better pri/pub git.
Diffstat (limited to 'services/docker/v2ray')
-rw-r--r-- | services/docker/v2ray/Dockerfile | 6 | ||||
-rw-r--r-- | services/docker/v2ray/config.json.template | 29 | ||||
-rwxr-xr-x | services/docker/v2ray/v2ray-wrapper.sh | 17 |
3 files changed, 50 insertions, 2 deletions
diff --git a/services/docker/v2ray/Dockerfile b/services/docker/v2ray/Dockerfile index 250a6b8..9d11474 100644 --- a/services/docker/v2ray/Dockerfile +++ b/services/docker/v2ray/Dockerfile @@ -1,5 +1,7 @@ FROM alpine:edge -RUN apk add --no-cache v2ray +RUN apk add --no-cache tini v2ray -ENTRYPOINT [ "/usr/bin/v2ray" ] +ADD config.json.template v2ray-wrapper.sh /app/ + +CMD [ "tini", "--", "/app/v2ray-wrapper.sh" ] diff --git a/services/docker/v2ray/config.json.template b/services/docker/v2ray/config.json.template new file mode 100644 index 0000000..c10eac2 --- /dev/null +++ b/services/docker/v2ray/config.json.template @@ -0,0 +1,29 @@ +{ + "inbounds": [ + { + "port": 10000, + "listen": "0.0.0.0", + "protocol": "vmess", + "settings": { + "clients": [ + { + "id": "@@CRUPEST_V2RAY_TOKEN@@", + "alterId": 0 + } + ] + }, + "streamSettings": { + "network": "ws", + "wsSettings": { + "path": "/_@@CRUPEST_V2RAY_PATH@@" + } + } + } + ], + "outbounds": [ + { + "protocol": "freedom", + "settings": {} + } + ] +}
\ No newline at end of file diff --git a/services/docker/v2ray/v2ray-wrapper.sh b/services/docker/v2ray/v2ray-wrapper.sh new file mode 100755 index 0000000..3887a0e --- /dev/null +++ b/services/docker/v2ray/v2ray-wrapper.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +die() { + echo "$@" >&2 + exit 1 +} + +[ -n "$CRUPEST_V2RAY_TOKEN" ] || die "CRUPEST_V2RAY_TOKEN is not set. It is used as password of v2ray tunnel." +[ -n "$CRUPEST_V2RAY_PATH" ] || die "CRUPEST_V2RAY_PATH is not set. It is used as the http endpoint." + +sed -e "s|@@CRUPEST_V2RAY_TOKEN@@|$CRUPEST_V2RAY_TOKEN|" \ + -e "s|@@CRUPEST_V2RAY_PATH@@|$CRUPEST_V2RAY_PATH|" \ + "/app/config.json.template" > /app/config.json + +exec /usr/bin/v2ray run -c /app/config.json |