Upload 3 files
Browse files- Dockerfile +35 -20
- supervisord.conf +22 -0
- vmess-ws.json +31 -0
Dockerfile
CHANGED
@@ -1,23 +1,38 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
# https://huggingface.co/docs/hub/spaces-sdks-docker#permissions
|
4 |
-
# 最终运行容器的用户是这个“user”,所以下面即使是用 root 安装软件、创建目录后,也要给“user”赋予权限
|
5 |
-
RUN adduser -D -H -u 1000 user
|
6 |
-
USER user
|
7 |
|
|
|
8 |
USER root
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
1 |
+
# 基于 python:3.11-alpine 环境
|
2 |
+
FROM python:3.11-alpine
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
# 当前操作为root权限
|
5 |
USER root
|
6 |
+
RUN apk update \
|
7 |
+
&& apk add -U supervisor \
|
8 |
+
&& apk add curl tar
|
9 |
+
RUN mkdir -p /var/log/supervisor
|
10 |
+
COPY supervisord.conf /etc/
|
11 |
+
|
12 |
+
# 创建用户 joey,并设定其id为1000
|
13 |
+
RUN adduser -u 1000 -D joey
|
14 |
+
# 新建用户目录
|
15 |
+
RUN mkdir -p /home/joey/v2ray/logs
|
16 |
+
|
17 |
+
# 赋予用户对其目录的所属权并更改文件模式
|
18 |
+
RUN chown -R joey:1000 /home/joey/v2ray \
|
19 |
+
&& chmod 755 /home/joey \
|
20 |
+
&& chmod 777 /etc/supervisord.conf \
|
21 |
+
&& chmod 777 /usr/bin/supervisord \
|
22 |
+
&& chmod 777 -R /var/log/supervisor
|
23 |
+
|
24 |
+
# 切换到 joey 用户,后续的代码运行权限为joey
|
25 |
+
USER joey
|
26 |
+
COPY --chown=joey vmess-ws.json /home/joey/v2ray/vmess-ws.json
|
27 |
+
|
28 |
+
RUN curl -L -o /home/joey/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 \
|
29 |
+
&& chmod +x /home/joey/cloudflared
|
30 |
+
|
31 |
+
# 设置工作目录
|
32 |
+
WORKDIR /home/joey/v2ray
|
33 |
+
ADD --chown=joey https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-64.zip /home/joey/v2ray/v2ray-linux-64.zip
|
34 |
+
RUN unzip v2ray-linux-64.zip && rm -f v2ray-linux-64.zip
|
35 |
|
36 |
+
# 运行指令
|
37 |
+
EXPOSE 30000
|
38 |
+
ENTRYPOINT supervisord -u joey -c /etc/supervisord.conf && mkdir tmp && cd tmp && python -m http.server 30000
|
supervisord.conf
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[supervisord]
|
2 |
+
nodaemon=false
|
3 |
+
|
4 |
+
[program:v2ray]
|
5 |
+
command=/home/joey/v2ray/v2ray run -c /home/joey/v2ray/vmess-ws.json
|
6 |
+
autostart=true
|
7 |
+
autorestart=true
|
8 |
+
redirect_stderr=true
|
9 |
+
|
10 |
+
[program:cloudflared]
|
11 |
+
command=/home/joey/cloudflared tunnel run --token eyJhIjoiMjY4ZDJhZWZiY2MxOGRhMTg3ZmJjZDcwNzcyZmE3MDgiLCJ0IjoiNzNkYjIzM2UtMzI2Zi00YmJlLTg3OTktZjU2MmEyMmYxMDgzIiwicyI6IllUSTJaRFl4TUdJdE0yUm1aaTAwWkRVeExXSXlOamN0TTJRd09UVmhaRFl6WlRGbSJ9
|
12 |
+
autostart=true
|
13 |
+
autorestart=true
|
14 |
+
redirect_stderr=true
|
15 |
+
|
16 |
+
[unix_http_server]
|
17 |
+
file=/home/joey/supervisor.sock
|
18 |
+
[rpcinterface:supervisor]
|
19 |
+
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
20 |
+
|
21 |
+
[supervisorctl]
|
22 |
+
serverurl=unix:///home/joey/supervisor.sock
|
vmess-ws.json
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"log": {
|
3 |
+
"loglevel": "warning",
|
4 |
+
"access": "/home/joey/v2ray/logs/access.log",
|
5 |
+
"error": "/home/joey/v2ray/logs/error.log"
|
6 |
+
},
|
7 |
+
"inbounds": [
|
8 |
+
{
|
9 |
+
"port": 26666,
|
10 |
+
"protocol": "vmess",
|
11 |
+
"settings": {
|
12 |
+
"clients": [
|
13 |
+
{
|
14 |
+
"id": "72a57957-2e50-4ae2-9a16-86290f7f9447",
|
15 |
+
"alterId": 0
|
16 |
+
}
|
17 |
+
]
|
18 |
+
},
|
19 |
+
"streamSettings": {
|
20 |
+
"network": "ws",
|
21 |
+
"security": "none",
|
22 |
+
"wsSettings": {}
|
23 |
+
}
|
24 |
+
}
|
25 |
+
],
|
26 |
+
"outbounds": [
|
27 |
+
{
|
28 |
+
"protocol": "freedom"
|
29 |
+
}
|
30 |
+
]
|
31 |
+
}
|