Spaces:
Running
on
Zero
Running
on
Zero
bug
Browse files- Dockerfile +1 -6
- app.py +2 -2
Dockerfile
CHANGED
@@ -16,7 +16,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
16 |
python3.10 \
|
17 |
python3.10-dev \
|
18 |
python3.10-distutils \
|
19 |
-
redis-server \
|
20 |
&& ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
|
21 |
&& apt-get clean \
|
22 |
&& rm -rf /var/lib/apt/lists/*
|
@@ -38,13 +37,9 @@ RUN pip install --no-cache-dir -r requirements.txt \
|
|
38 |
# アプリケーションのコピー
|
39 |
COPY . /app
|
40 |
|
41 |
-
# Redis の起動スクリプトを作成
|
42 |
-
RUN echo '#!/bin/bash\nredis-server --daemonize yes\npython app.py' > /app/start.sh \
|
43 |
-
&& chmod +x /app/start.sh
|
44 |
-
|
45 |
# 非rootユーザーの作成と切り替え
|
46 |
RUN useradd -m appuser && chown -R appuser:appuser /app
|
47 |
USER appuser
|
48 |
|
49 |
# 起動コマンドを変更
|
50 |
-
CMD ["
|
|
|
16 |
python3.10 \
|
17 |
python3.10-dev \
|
18 |
python3.10-distutils \
|
|
|
19 |
&& ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime \
|
20 |
&& apt-get clean \
|
21 |
&& rm -rf /var/lib/apt/lists/*
|
|
|
37 |
# アプリケーションのコピー
|
38 |
COPY . /app
|
39 |
|
|
|
|
|
|
|
|
|
40 |
# 非rootユーザーの作成と切り替え
|
41 |
RUN useradd -m appuser && chown -R appuser:appuser /app
|
42 |
USER appuser
|
43 |
|
44 |
# 起動コマンドを変更
|
45 |
+
CMD ["python", "app.py"]
|
app.py
CHANGED
@@ -87,8 +87,8 @@ def process_task(task):
|
|
87 |
del task_futures[task.task_id]
|
88 |
|
89 |
# タスク数をデクリメント
|
90 |
-
client_ip = task.client_ip
|
91 |
-
|
92 |
|
93 |
update_queue_status('Task completed or cancelled')
|
94 |
|
|
|
87 |
del task_futures[task.task_id]
|
88 |
|
89 |
# タスク数をデクリメント
|
90 |
+
client_ip = task.client_ip
|
91 |
+
tasks_per_client[client_ip] = tasks_per_client.get(client_ip, 0) - 1
|
92 |
|
93 |
update_queue_status('Task completed or cancelled')
|
94 |
|