安全性更新

This commit is contained in:
Sahik committed 2026-11-25 15:57:10 +08:00
1 parent 5bd77d2599
commit e75f0c95e9
29 files changed
+726 -143

No files matched your search

+5
View File
@@ -18,5 +18,10 @@ COPY web ./web
ENV DATA_DIR=/data MEME_DIR=/memes WEB_DIR=/app/web
EXPOSE 2040
# 不用 root 執行。掛進來的 /data、/memes 要給這個 UID(或用 docker 的 user 設定換成別的 UID)
RUN groupadd -g 3004 zhiwu && useradd -u 3007 -g 3004 -M -s /usr/sbin/nologin zhiwu \
&& mkdir -p /data /memes && chown 3007:3004 /data /memes
USER 3007:3004
# SQLite 與記憶體裡的限流都假設只有一個 worker
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "2040", "--workers", "1"]