Update Dockerfile
Browse files- Dockerfile +4 -23
Dockerfile
CHANGED
@@ -1,27 +1,8 @@
|
|
1 |
-
# 步骤 1: 继承自 zhezzma/v2fly-core 镜像
|
2 |
FROM zhezzma/v2fly-core:latest
|
3 |
|
4 |
-
#
|
5 |
COPY config.json.template /etc/v2ray/config.json.template
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
if [ -z "$UUID" ]; then\
|
10 |
-
echo "错误: UUID环境变量未设置"\n\
|
11 |
-
exit 1\n\
|
12 |
-
fi\n\
|
13 |
-
echo "使用UUID: $UUID"\n\
|
14 |
-
sed "s/env:UUID/$UUID/g" /etc/v2ray/config.json.template > /etc/v2ray/config.json\n\
|
15 |
-
echo "生成的配置文件内容:"\n\
|
16 |
-
cat /etc/v2ray/config.json\n\
|
17 |
-
echo "启动V2Ray..."\n\
|
18 |
-
exec /usr/bin/v2ray run -config /etc/v2ray/config.json' > /usr/local/bin/start.sh
|
19 |
-
|
20 |
-
# 步骤 4: 给启动脚本执行权限
|
21 |
-
RUN chmod +x /usr/local/bin/start.sh
|
22 |
-
|
23 |
-
# 步骤 5: 验证文件是否存在(调试用)
|
24 |
-
RUN ls -la /usr/local/bin/start.sh
|
25 |
-
|
26 |
-
# 步骤 6: 设置容器启动命令
|
27 |
-
ENTRYPOINT ["/usr/local/bin/start.sh"]
|
|
|
|
|
1 |
FROM zhezzma/v2fly-core:latest
|
2 |
|
3 |
+
# 复制配置模板
|
4 |
COPY config.json.template /etc/v2ray/config.json.template
|
5 |
|
6 |
+
# 直接使用CMD执行命令,避免创建脚本文件
|
7 |
+
ENTRYPOINT ["/bin/sh", "-c"]
|
8 |
+
CMD ["if [ -z \"$UUID\" ]; then echo '错误: UUID环境变量未设置'; exit 1; fi; echo \"使用UUID: $UUID\"; sed \"s/env:UUID/$UUID/g\" /etc/v2ray/config.json.template > /etc/v2ray/config.json; echo '生成的配置文件内容:'; cat /etc/v2ray/config.json; echo '启动V2Ray...'; exec /usr/bin/v2ray run -config /etc/v2ray/config.json"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|