Upload 2 files
Browse files- Dockerfile +13 -0
- xf.sh +94 -0
Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
##
|
2 |
+
|
3 |
+
FROM alpine:latest
|
4 |
+
|
5 |
+
WORKDIR /root
|
6 |
+
COPY xf.sh /root/xf.sh
|
7 |
+
|
8 |
+
RUN set -ex \
|
9 |
+
&& apk add --no-cache tzdata openssl ca-certificates \
|
10 |
+
&& mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray \
|
11 |
+
&& chmod +x /root/xf.sh
|
12 |
+
|
13 |
+
CMD [ "/root/xf.sh" ]
|
xf.sh
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
##
|
3 |
+
|
4 |
+
# Set ARG
|
5 |
+
ARCH="64"
|
6 |
+
DOWNLOAD_PATH="/tmp/v2ray"
|
7 |
+
|
8 |
+
mkdir -p ${DOWNLOAD_PATH}
|
9 |
+
cd ${DOWNLOAD_PATH} || exit
|
10 |
+
|
11 |
+
TAG=$(wget --no-check-certificate -qO- https://api.github.com/repos/v2fly/v2ray-core/releases/latest | grep 'tag_name' | cut -d\" -f4)
|
12 |
+
if [ -z "${TAG}" ]; then
|
13 |
+
echo "Error: Get v2ray latest version failed" && exit 1
|
14 |
+
fi
|
15 |
+
echo "The v2ray latest version: ${TAG}"
|
16 |
+
|
17 |
+
# Download files
|
18 |
+
V2RAY_FILE="v2ray-linux-${ARCH}.zip"
|
19 |
+
DGST_FILE="v2ray-linux-${ARCH}.zip.dgst"
|
20 |
+
echo "Downloading binary file: ${V2RAY_FILE}"
|
21 |
+
echo "Downloading binary file: ${DGST_FILE}"
|
22 |
+
|
23 |
+
# TAG=$(wget -qO- https://raw.githubusercontent.com/v2fly/docker/master/ReleaseTag | head -n1)
|
24 |
+
wget -O ${DOWNLOAD_PATH}/v2ray.zip https://github.com/v2fly/v2ray-core/releases/download/${TAG}/${V2RAY_FILE} >/dev/null 2>&1
|
25 |
+
wget -O ${DOWNLOAD_PATH}/v2ray.zip.dgst https://github.com/v2fly/v2ray-core/releases/download/${TAG}/${DGST_FILE} >/dev/null 2>&1
|
26 |
+
|
27 |
+
if [ $? -ne 0 ]; then
|
28 |
+
echo "Error: Failed to download binary file: ${V2RAY_FILE} ${DGST_FILE}" && exit 1
|
29 |
+
fi
|
30 |
+
echo "Download binary file: ${V2RAY_FILE} ${DGST_FILE} completed"
|
31 |
+
|
32 |
+
# Check SHA512
|
33 |
+
LOCAL=$(openssl dgst -sha512 v2ray.zip | sed 's/([^)]*)//g')
|
34 |
+
STR=$(cat < v2ray.zip.dgst | grep 'SHA512' | head -n1)
|
35 |
+
|
36 |
+
if [ "${LOCAL}" = "${STR}" ]; then
|
37 |
+
echo " Check passed" && rm -fv v2ray.zip.dgst
|
38 |
+
else
|
39 |
+
echo " Check have not passed yet " && exit 1
|
40 |
+
fi
|
41 |
+
|
42 |
+
# Prepare
|
43 |
+
echo "Prepare to use"
|
44 |
+
unzip v2ray.zip && chmod +x v2ray v2ctl
|
45 |
+
mv v2ray v2ctl /usr/bin/
|
46 |
+
mv geosite.dat geoip.dat /usr/local/share/v2ray/
|
47 |
+
# mv config.json /etc/v2ray/config.json
|
48 |
+
|
49 |
+
# Set config file
|
50 |
+
cat <<EOF >/etc/v2ray/config.json
|
51 |
+
{
|
52 |
+
"log": {
|
53 |
+
"loglevel": "warning"
|
54 |
+
},
|
55 |
+
"inbounds": [
|
56 |
+
{
|
57 |
+
"listen": "0.0.0.0",
|
58 |
+
"port": 8080,
|
59 |
+
"protocol": "vmess",
|
60 |
+
"settings": {
|
61 |
+
"clients": [
|
62 |
+
{
|
63 |
+
"id": "11111111-1111-1111-1111-111111111111",
|
64 |
+
"alterId": 0
|
65 |
+
}
|
66 |
+
],
|
67 |
+
"disableInsecureEncryption": true
|
68 |
+
},
|
69 |
+
"streamSettings": {
|
70 |
+
"network": "ws"
|
71 |
+
}
|
72 |
+
}
|
73 |
+
],
|
74 |
+
"outbounds": [
|
75 |
+
{
|
76 |
+
"protocol": "freedom"
|
77 |
+
}
|
78 |
+
]
|
79 |
+
}
|
80 |
+
EOF
|
81 |
+
|
82 |
+
# Clean
|
83 |
+
cd ~ || return
|
84 |
+
rm -rf ${DOWNLOAD_PATH:?}/*
|
85 |
+
echo "Install done"
|
86 |
+
|
87 |
+
echo "--------------------------------"
|
88 |
+
echo "Fly App Name: ${FLY_APP_NAME}"
|
89 |
+
echo "Fly App Region: ${FLY_REGION}"
|
90 |
+
echo "V2Ray UUID: ${UUID}"
|
91 |
+
echo "--------------------------------"
|
92 |
+
|
93 |
+
# Run v2ray
|
94 |
+
/usr/bin/v2ray -config /etc/v2ray/config.json
|