Update Dockerfile
Browse files- Dockerfile +17 -8
Dockerfile
CHANGED
@@ -1,11 +1,20 @@
|
|
1 |
-
# 步骤 1: 继承自 zhezzma/v2fly-core 镜像
|
2 |
FROM zhezzma/v2fly-core:latest
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
|
10 |
-
#
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
FROM zhezzma/v2fly-core:latest
|
2 |
|
3 |
+
# 安装envsubst工具(通常在gettext包中)
|
4 |
+
RUN apt-get update && apt-get install -y gettext-base && rm -rf /var/lib/apt/lists/*
|
5 |
|
6 |
+
# 复制配置模板
|
7 |
+
COPY config.json.template /etc/v2ray/config.json.template
|
8 |
+
|
9 |
+
# 创建启动脚本
|
10 |
+
RUN echo '#!/bin/bash\n\
|
11 |
+
if [ -z "$UUID" ]; then\n\
|
12 |
+
echo "错误: UUID环境变量未设置"\n\
|
13 |
+
exit 1\n\
|
14 |
+
fi\n\
|
15 |
+
envsubst < /etc/v2ray/config.json.template > /etc/v2ray/config.json\n\
|
16 |
+
exec /usr/bin/v2ray run -config /etc/v2ray/config.json' > /usr/local/bin/start.sh
|
17 |
+
|
18 |
+
RUN chmod +x /usr/local/bin/start.sh
|
19 |
+
|
20 |
+
ENTRYPOINT ["/usr/local/bin/start.sh"]
|