Skip to content

Commit

Permalink
dockerfile: install v2ray on container build
Browse files Browse the repository at this point in the history
  • Loading branch information
Snawoot committed May 5, 2021
1 parent b3c2371 commit 4f5c4de
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 38 deletions.
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
FROM debian:sid

ARG V2RAY_VERSION=v1.3.1

COPY wwwroot.tar.gz /wwwroot/wwwroot.tar.gz
COPY conf/ /conf
COPY entrypoint.sh /entrypoint.sh

ARG DEBIAN_FRONTEND=noninteractive
RUN set -ex\
&& apt update -y \
&& apt upgrade -y \
&& apt install -y wget unzip qrencode\
&& apt install -y shadowsocks-libev\
&& apt install -y nginx\
&& apt install -y wget unzip qrencode \
&& apt install -y shadowsocks-libev \
&& apt install -y nginx-light \
&& apt autoremove -y \
&& apt clean -y \
&& tar xvf /wwwroot/wwwroot.tar.gz -C /wwwroot \
&& rm -rf /wwwroot/wwwroot.tar.gz \
&& chmod +x /entrypoint.sh \
&& mkdir -p /etc/shadowsocks-libev /v2raybin
&& mkdir -p /etc/shadowsocks-libev /v2raybin \
&& wget -O- "https://github.com/shadowsocks/v2ray-plugin/releases/download/${V2RAY_VERSION}/v2ray-plugin-linux-amd64-${V2RAY_VERSION}.tar.gz" | \
tar zx -C /v2raybin \
&& install /v2raybin/v2ray-plugin_linux_amd64 /usr/bin/v2ray-plugin \
&& rm -rf /v2raybin

CMD /entrypoint.sh
5 changes: 0 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"value": "5c301bb8-6c77-41a0-a606-4ba11bbab084"
},

"VER": {
"description": "v2ray-plugin version, the latest version is installed by default, you can go to https://github.com/shadowsocks/v2ray-plugin/releasesV2Ray to select the version (for example: 1.1.0)",
"value": "latest"
},

"V2_Path": {
"description": "Path path, default /s233, you can also replace s233 with uuid for safety, / cannot be less. If anti-generation is turned on, do not repeat with anti-generation uri",
"value": "/s233"
Expand Down
34 changes: 5 additions & 29 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,24 @@
#!/bin/bash

#v2ray-plugin版本
if [[ -z "${VER}" ]]; then
VER="latest"
fi
echo ${VER}

if [[ -z "${PASSWORD}" ]]; then
PASSWORD="5c301bb8-6c77-41a0-a606-4ba11bbab084"
export PASSWORD="5c301bb8-6c77-41a0-a606-4ba11bbab084"
fi
echo ${PASSWORD}

if [[ -z "${ENCRYPT}" ]]; then
ENCRYPT="chacha20-ietf-poly1305"
export ENCRYPT="chacha20-ietf-poly1305"
fi


if [[ -z "${V2_Path}" ]]; then
V2_Path="/s233"
export V2_Path="/s233"
fi
echo ${V2_Path}

if [[ -z "${QR_Path}" ]]; then
QR_Path="/qr_img"
export QR_Path="/qr_img"
fi
echo ${QR_Path}


if [ "$VER" = "latest" ]; then
V_VER=`wget -qO- "https://api.github.com/repos/shadowsocks/v2ray-plugin/releases/latest" | sed -n -r -e 's/.*"tag_name".+?"([vV0-9\.]+?)".*/\1/p'`
[[ -z "${V_VER}" ]] && V_VER="v1.3.0"
else
V_VER="v$VER"
fi

cd /v2raybin
V2RAY_URL="https://github.com/shadowsocks/v2ray-plugin/releases/download/${V_VER}/v2ray-plugin-linux-amd64-${V_VER}.tar.gz"
echo ${V2RAY_URL}
wget ${V2RAY_URL}
tar -zxvf v2ray-plugin-linux-amd64-$V_VER.tar.gz
rm -rf v2ray-plugin-linux-amd64-$V_VER.tar.gz
mv v2ray-plugin_linux_amd64 /usr/bin/v2ray-plugin
rm -rf /v2raybin

bash /conf/shadowsocks-libev_config.json > /etc/shadowsocks-libev/config.json
echo /etc/shadowsocks-libev/config.json
cat /etc/shadowsocks-libev/config.json
Expand All @@ -53,7 +29,7 @@ cat /etc/nginx/conf.d/ss.conf


if [ "$AppName" = "no" ]; then
echo "不生成二维码"
echo "Do not generate QR-code"
else
[ ! -d /wwwroot/${QR_Path} ] && mkdir /wwwroot/${QR_Path}
plugin=$(echo -n "v2ray;path=${V2_Path};host=${AppName}.herokuapp.com;tls" | sed -e 's/\//%2F/g' -e 's/=/%3D/g' -e 's/;/%3B/g')
Expand Down

0 comments on commit 4f5c4de

Please sign in to comment.