From 25755aa15319e0e0ce1a4d0a3d8ad26649459b34 Mon Sep 17 00:00:00 2001 From: Toperlock <861705708@qq.com> Date: Thu, 15 Aug 2024 18:02:24 +0800 Subject: [PATCH] Docker --- Dockerfile | 8 ++++++++ README.md | 7 +++++++ api/app.py | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..8aab2111f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.11-slim +COPY . /sing-box-subscribe +WORKDIR /sing-box-subscribe +RUN \ + pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir -r requirements.txt +EXPOSE 5000 +CMD ["python", "api/app.py"] \ No newline at end of file diff --git a/README.md b/README.md index 183921c8e..24dd86947 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,13 @@ python main.py python main.py --template_index=0 ``` +支持Docker + +``` +docker build --tag 'sing-box' . +docker run -p 5000:5000 sing-box:latest +``` + ### 根据已有的qx,surge,loon,clash规则列表自定义规则集[https://github.com/Toperlock/sing-box-geosite](https://github.com/Toperlock/sing-box-geosite) ### wechat规则集源文件写法: diff --git a/api/app.py b/api/app.py index 86d1c0931..48124ce60 100644 --- a/api/app.py +++ b/api/app.py @@ -343,4 +343,4 @@ def download_config(): return str(e) # 或者适当处理异常,例如返回一个错误页面 """ if __name__ == '__main__': - app.run(debug=True) \ No newline at end of file + app.run(debug=True, host='0.0.0.0') \ No newline at end of file