zhepama commited on
Commit
43d2c44
·
verified ·
1 Parent(s): b40acec

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -6
Dockerfile CHANGED
@@ -1,20 +1,27 @@
 
1
  FROM zhezzma/v2fly-core:latest
2
 
3
- # 在Alpine Linux中安装gettext包(包含envsubst工具)
4
- RUN apk add --no-cache gettext
5
-
6
- # 复制配置模板
7
  COPY config.json.template /etc/v2ray/config.json.template
8
 
9
- # 创建启动脚本
10
  RUN echo '#!/bin/sh\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"]
 
1
+ # 步骤 1: 继承自 zhezzma/v2fly-core 镜像
2
  FROM zhezzma/v2fly-core:latest
3
 
4
+ # 步骤 2: 复制配置模板
 
 
 
5
  COPY config.json.template /etc/v2ray/config.json.template
6
 
7
+ # 步骤 3: 直接在Dockerfile中创建启动脚本
8
  RUN echo '#!/bin/sh\n\
9
  if [ -z "$UUID" ]; then\n\
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"]