fangbin commited on
Commit
77b790b
·
1 Parent(s): fedf340
Files changed (2) hide show
  1. Dockerfile +8 -1
  2. modules/core.py +5 -2
Dockerfile CHANGED
@@ -12,6 +12,8 @@ RUN apt-get update && apt-get install -y \
12
  g++ \
13
  python3-tk \
14
  tk-dev \
 
 
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
  # 复制项目文件到容器中
@@ -21,12 +23,17 @@ COPY . /app
21
  RUN pip install --upgrade pip
22
 
23
  # 安装 Python 依赖
24
- RUN pip install -r requirements.txt
25
 
26
  # 设置环境变量
27
  ENV PYTHONUNBUFFERED=1
28
  ENV LANG=C.UTF-8
29
  ENV LC_ALL=C.UTF-8
 
 
 
 
 
30
 
31
  # 运行应用
32
  CMD ["python", "run.py"]
 
12
  g++ \
13
  python3-tk \
14
  tk-dev \
15
+ ffmpeg \
16
+ fonts-liberation \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
  # 复制项目文件到容器中
 
23
  RUN pip install --upgrade pip
24
 
25
  # 安装 Python 依赖
26
+ RUN pip install --no-cache-dir -r requirements.txt
27
 
28
  # 设置环境变量
29
  ENV PYTHONUNBUFFERED=1
30
  ENV LANG=C.UTF-8
31
  ENV LC_ALL=C.UTF-8
32
+ ENV MPLCONFIGDIR=/tmp/matplotlib
33
+
34
+ # 创建必要的目录并设置权限
35
+ RUN mkdir -p /.fonts /.config && \
36
+ chmod 777 /.fonts /.config
37
 
38
  # 运行应用
39
  CMD ["python", "run.py"]
modules/core.py CHANGED
@@ -167,9 +167,12 @@ def pre_check() -> bool:
167
 
168
 
169
  def update_status(message: str, scope: str = 'DLC.CORE') -> None:
170
- print(f'[{scope}] {message}')
171
- if not modules.globals.headless:
172
  ui.update_status(message)
 
 
 
173
 
174
  def start() -> None:
175
  for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):
 
167
 
168
 
169
  def update_status(message: str, scope: str = 'DLC.CORE') -> None:
170
+ if 'DISPLAY' in os.environ:
171
+ # GUI 环境
172
  ui.update_status(message)
173
+ else:
174
+ # 非 GUI 环境
175
+ print(f"[{scope}] {message}")
176
 
177
  def start() -> None:
178
  for frame_processor in get_frame_processors_modules(modules.globals.frame_processors):