sadg456 commited on
Commit
4ecdf66
·
verified ·
1 Parent(s): a6082fd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -28
Dockerfile CHANGED
@@ -1,31 +1,10 @@
1
- FROM alpine:latest
2
 
3
- # 安装必要工具
4
- RUN apk add --no-cache curl tar
5
 
6
- # 创建非 root 用户和组
7
- RUN addgroup -S singbox && adduser -S singbox -G singbox
8
 
9
- # 创建工作目录并赋权限
10
- RUN mkdir /app && chown singbox:singbox /app
11
-
12
- WORKDIR /app
13
-
14
- # 下载并安装 sing-box
15
- RUN curl -L https://github.com/SagerNet/sing-box/releases/download/v1.11.11/sing-box-1.11.11-linux-amd64.tar.gz \
16
- -o sing-box.tar.gz && \
17
- tar -xzf sing-box.tar.gz && \
18
- mv sing-box-1.11.11-linux-amd64/sing-box /usr/local/bin/sing-box && \
19
- chmod +x /usr/local/bin/sing-box && \
20
- rm -rf sing-box.tar.gz sing-box-1.11.11-linux-amd64
21
-
22
- # 拷贝配置文件(构建时提供)
23
- COPY cf.json /app/config.json
24
-
25
- # (可选)确保配置文件是 utf-8,无 BOM,可以本地处理,容器内一般不必运行 iconv
26
-
27
- # 切换到非 root 用户
28
- USER singbox
29
-
30
- # 启动命令
31
- ENTRYPOINT ["sing-box", "run", "-c", "/app/config.json"]
 
1
+ FROM sing-box/sing-box:latest
2
 
3
+ # 复制本地配置文件到容器中
4
+ COPY cf.json /etc/sing-box/config.json
5
 
6
+ # 暴露端口(根据你配置的端口改)
7
+ EXPOSE 7860
8
 
9
+ # 运行 sing-box,指定配置文件路径
10
+ CMD ["sing-box", "run", "-c", "/etc/sing-box/config.json"]