Qilan2 commited on
Commit
be5c80a
·
verified ·
1 Parent(s): 867524f

Update dockerfile/Dockerfile12

Browse files
Files changed (1) hide show
  1. dockerfile/Dockerfile12 +19 -7
dockerfile/Dockerfile12 CHANGED
@@ -49,7 +49,8 @@ RUN python3 -m venv /opt/venv && \
49
  pytz \
50
  flask \
51
  kaggle \
52
- ipykernel
 
53
 
54
  # 安装 configurable-http-proxy
55
  RUN npm install -g configurable-http-proxy
@@ -58,7 +59,6 @@ RUN npm install -g configurable-http-proxy
58
  RUN echo "root ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
59
  chmod 0440 /etc/sudoers
60
 
61
-
62
  # 设置环境变量
63
  ENV JUPYTER_RUNTIME_DIR=/tmp/app/runtime
64
  ENV JUPYTER_DATA_DIR=/tmp/app/data
@@ -69,14 +69,26 @@ ENV PATH="/opt/venv/bin:$PATH"
69
  RUN mkdir -p /tmp/app/runtime && \
70
  chmod 777 /tmp/app/runtime
71
 
72
- # 暴露端口
73
- EXPOSE 7860
 
 
 
 
74
  RUN wget -O '/data/server.py' 'https://huggingface.co/datasets/Qilan2/st-server/raw/main/server12.py' && \
75
  wget -O '/data/start_server.sh' 'https://huggingface.co/datasets/Qilan2/st-server/raw/main/start_server.sh' && \
76
  chmod +x /data/start_server.sh
77
-
 
 
 
 
 
78
  CMD ["/data/start_server.sh"]
79
- # # 启动 Jupyterlab
 
 
 
80
  # CMD ["jupyter", "lab", \
81
  # "--ip=0.0.0.0", \
82
  # "--port=7860", \
@@ -84,4 +96,4 @@ CMD ["/data/start_server.sh"]
84
  # "--allow-root", \
85
  # "--notebook-dir=/data", \
86
  # "--NotebookApp.token='qilan'", \
87
- # "--ServerApp.disable_check_xsrf=True"]
 
49
  pytz \
50
  flask \
51
  kaggle \
52
+ ipykernel \
53
+ gunicorn
54
 
55
  # 安装 configurable-http-proxy
56
  RUN npm install -g configurable-http-proxy
 
59
  RUN echo "root ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \
60
  chmod 0440 /etc/sudoers
61
 
 
62
  # 设置环境变量
63
  ENV JUPYTER_RUNTIME_DIR=/tmp/app/runtime
64
  ENV JUPYTER_DATA_DIR=/tmp/app/data
 
69
  RUN mkdir -p /tmp/app/runtime && \
70
  chmod 777 /tmp/app/runtime
71
 
72
+ # 复制应用文件(如果存在)
73
+ COPY requirements.txt /data/requirements.txt
74
+ RUN . /opt/venv/bin/activate && \
75
+ pip install --no-cache-dir -r /data/requirements.txt || true
76
+
77
+ # 下载服务器脚本
78
  RUN wget -O '/data/server.py' 'https://huggingface.co/datasets/Qilan2/st-server/raw/main/server12.py' && \
79
  wget -O '/data/start_server.sh' 'https://huggingface.co/datasets/Qilan2/st-server/raw/main/start_server.sh' && \
80
  chmod +x /data/start_server.sh
81
+
82
+ # 复制应用代码
83
+ COPY . /data
84
+
85
+ # 暴露端口
86
+ EXPOSE 7860
87
  CMD ["/data/start_server.sh"]
88
+ # 启动 Gunicorn(可选择注释掉以使用 Jupyter)
89
+ # CMD ["gunicorn", "app:server", "--workers", "4", "--bind", "0.0.0.0:7860"]
90
+
91
+ # 如果需要启动 Jupyter 而不是 Gunicorn,注释上面的 CMD 并取消注释下面的:
92
  # CMD ["jupyter", "lab", \
93
  # "--ip=0.0.0.0", \
94
  # "--port=7860", \
 
96
  # "--allow-root", \
97
  # "--notebook-dir=/data", \
98
  # "--NotebookApp.token='qilan'", \
99
+ # "--ServerApp.disable_xsrf=True"]