LifeVta commited on
Commit
7a0a2bc
·
verified ·
1 Parent(s): f354b41

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -5
Dockerfile CHANGED
@@ -38,13 +38,21 @@ RUN uv sync --frozen --no-dev --no-install-project \
38
  # ── Runtime ───────────────────────────────────────────────────────────────────
39
  FROM python:3.13-alpine
40
 
 
41
  ENV PYTHONDONTWRITEBYTECODE=1 \
42
  PYTHONUNBUFFERED=1 \
43
  TZ=Asia/Shanghai \
44
  VIRTUAL_ENV=/opt/venv \
45
  SERVER_HOST=0.0.0.0 \
46
- SERVER_PORT=8000 \
47
- SERVER_WORKERS=1
 
 
 
 
 
 
 
48
 
49
  ENV PATH="$VIRTUAL_ENV/bin:$PATH"
50
 
@@ -65,13 +73,17 @@ COPY pyproject.toml config.defaults.toml ./
65
  COPY app ./app
66
  COPY scripts ./scripts
67
 
68
- RUN mkdir -p /app/data /app/logs \
 
 
 
69
  && chmod +x /app/scripts/entrypoint.sh /app/scripts/init_storage.sh
70
 
71
- EXPOSE 8000
 
72
 
73
  HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
74
  CMD ["sh", "-c", "wget -qO /dev/null http://127.0.0.1:${SERVER_PORT}/health || exit 1"]
75
 
76
  ENTRYPOINT ["/app/scripts/entrypoint.sh"]
77
- CMD ["sh", "-c", "exec granian --interface asgi --host ${SERVER_HOST} --port ${SERVER_PORT} --workers ${SERVER_WORKERS} app.main:app"]
 
38
  # ── Runtime ───────────────────────────────────────────────────────────────────
39
  FROM python:3.13-alpine
40
 
41
+ # 🌟 优化1:在这里直接注入图3、图4的默认开关(公开数据,不含密码,安全无公害)
42
  ENV PYTHONDONTWRITEBYTECODE=1 \
43
  PYTHONUNBUFFERED=1 \
44
  TZ=Asia/Shanghai \
45
  VIRTUAL_ENV=/opt/venv \
46
  SERVER_HOST=0.0.0.0 \
47
+ SERVER_PORT=7860 \
48
+ SERVER_WORKERS=1 \
49
+ APP_BASE_URL="https://lifevta-grok2api.hf.space/" \
50
+ ENABLE_WEBUI="true" \
51
+ TEMPORARY_SESSIONS="false" \
52
+ CONVERSATION_MEMORY="true" \
53
+ CONDENSED_REASONING="true" \
54
+ DYNAMIC_STATSIG="true" \
55
+ ALLOW_NSFW_GENERATION="true"
56
 
57
  ENV PATH="$VIRTUAL_ENV/bin:$PATH"
58
 
 
73
  COPY app ./app
74
  COPY scripts ./scripts
75
 
76
+ # 🌟 优化2:将 /app/data 建立软链接指向 HF 的永久挂载盘 /data
77
+ # 这样程序以为自己在写 /app/data/accounts.db,其实全掉进了永不丢失的 /data 里!
78
+ RUN mkdir -p /app/logs \
79
+ && ln -s /data /app/data \
80
  && chmod +x /app/scripts/entrypoint.sh /app/scripts/init_storage.sh
81
 
82
+ # 🌟 优化3:将暴露端口修正为 Hugging Face 规定的 7860
83
+ EXPOSE 7860
84
 
85
  HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
86
  CMD ["sh", "-c", "wget -qO /dev/null http://127.0.0.1:${SERVER_PORT}/health || exit 1"]
87
 
88
  ENTRYPOINT ["/app/scripts/entrypoint.sh"]
89
+ CMD ["sh", "-c", "exec granian --interface asgi --host ${SERVER_HOST} --port ${SERVER_PORT} --workers ${SERVER_WORKERS} app.main:app"]