sadg456 commited on
Commit
5c579fa
·
verified ·
1 Parent(s): e07f980

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -16
Dockerfile CHANGED
@@ -1,16 +1,27 @@
1
- FROM ubuntu:22.04
2
- ENV TZ=Asia/Shanghai
3
- RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
4
- echo $TZ > /etc/timezone
5
- ENV DEBIAN_FRONTEND=noninteractive
6
- RUN apt-get update && \
7
- apt-get install -y git python3 python3-pip tzdata curl && \
8
- rm -rf /var/lib/apt/lists/*
9
- WORKDIR /zmal
10
- RUN git clone --depth=1 -b main https://github.com/wyf9/sleepy.git
11
- WORKDIR /zmal/sleepy
12
- RUN pip install --no-cache-dir -r requirements.txt
13
- RUN chmod -R 777 /zmal/sleepy
14
- EXPOSE 7860
15
- COPY . /zmal/sleepy
16
- CMD python3 server.py
 
 
 
 
 
 
 
 
 
 
 
 
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
+ WORKDIR /app
11
+
12
+ # 下载并安装 sing-box(你也可以改成特定版本)
13
+ RUN curl -L https://github.com/SagerNet/sing-box/releases/latest/download/sing-box-linux-amd64.tar.gz \
14
+ -o sing-box.tar.gz && \
15
+ tar -xzf sing-box.tar.gz && \
16
+ mv sing-box /usr/local/bin/sing-box && \
17
+ chmod +x /usr/local/bin/sing-box && \
18
+ rm -f sing-box.tar.gz
19
+
20
+ # 拷贝配置文件(你需要在构建时提供 config.json)
21
+ COPY cf.json /app/config.json
22
+
23
+ # 切换到非 root 用户
24
+ USER singbox
25
+
26
+ # 设置启动命令
27
+ ENTRYPOINT ["sing-box", "run", "-c", "/app/config.json"]