* 禁用 OSS 非必需校验尾部,改用精确会话前缀逐对象清理 * 保护上传终态与分享事务,清理失败保留会话并支持安全重试 * 统一下载响应头,兼容旧下载器并防止文件名注入 * 限流改用单调时钟并限制 IP 记录,缓存模板与静态资源策略 * 统一 ORM 初始化与异常处理,新增查询索引及 SQLite 性能参数 * 固定 uvloop/httptools,统一 Docker keep-alive 与内存回收配置 * 同步版本与升级文档,补充 OSS、清理、缓存及数据库回归验证
34 lines
1.7 KiB
Docker
34 lines
1.7 KiB
Docker
# Build the exact reviewed 2026 frontend while preserving the existing legacy themes.
|
|
ARG BASE_IMAGE
|
|
FROM --platform=$BUILDPLATFORM node:22-alpine AS frontend
|
|
ARG FRONTEND_2026_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2026.git
|
|
ARG FRONTEND_2026_REF
|
|
RUN apk add --no-cache git && corepack enable && corepack prepare pnpm@9.15.9 --activate
|
|
WORKDIR /build
|
|
RUN test -n "$FRONTEND_2026_REF" && \
|
|
git init . && git remote add origin "$FRONTEND_2026_REPO" && \
|
|
git fetch --depth 1 origin "$FRONTEND_2026_REF" && git checkout --detach FETCH_HEAD && \
|
|
test "$(git rev-parse HEAD)" = "$FRONTEND_2026_REF" && \
|
|
pnpm install --frozen-lockfile --prod=false && \
|
|
node --experimental-strip-types --test --experimental-test-coverage tests/*.test.mjs && \
|
|
pnpm run build
|
|
|
|
FROM ${BASE_IMAGE}
|
|
ARG APP_VERSION
|
|
ARG VCS_REF
|
|
ARG FRONTEND_2026_REF
|
|
LABEL org.opencontainers.image.version="${APP_VERSION}"
|
|
LABEL org.opencontainers.image.revision="${VCS_REF}"
|
|
LABEL org.opencontainers.image.filecodebox.frontend-2026-revision="${FRONTEND_2026_REF}"
|
|
WORKDIR /app
|
|
COPY VERSION requirements.txt main.py ./
|
|
COPY apps ./apps
|
|
COPY core ./core
|
|
COPY scripts ./scripts
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
COPY --from=frontend /build/dist ./themes/2026
|
|
ENV APP_VERSION="${APP_VERSION}"
|
|
|
|
ENV TIMEOUT_KEEP_ALIVE=5 MALLOC_TRIM_THRESHOLD_=65536
|
|
CMD ["sh", "-c", "access_log_arg=--no-access-log; if [ \"${APP_ENV:-development}\" != \"production\" ] || [ \"${ACCESS_LOG:-false}\" = \"true\" ]; then access_log_arg=--access-log; fi; exec uvicorn main:app --host \"$HOST\" --port \"$PORT\" --workers \"$WORKERS\" --log-level \"$LOG_LEVEL\" \"$access_log_arg\" --timeout-keep-alive \"${TIMEOUT_KEEP_ALIVE:-5}\" --proxy-headers --forwarded-allow-ips \"${FORWARDED_ALLOW_IPS:-}\""]
|