✨ 新增回收站审计与八位取件码
This commit is contained in:
1 parent
5e71cde60e
commit
6bc1c30797
17 files changed
+6309
No files matched your search
+98
@@ -0,0 +1,98 @@
|
||||
# 第一阶段:构建前端主题
|
||||
# 前端产物与 CPU 架构无关,使用原生构建平台避免在 QEMU 中运行 Node/pnpm。
|
||||
FROM --platform=$BUILDPLATFORM node:20-alpine AS frontend-builder
|
||||
|
||||
ARG FRONTEND_2024_REF=main
|
||||
ARG FRONTEND_2023_REF=main
|
||||
|
||||
RUN apk add --no-cache git python3 make g++
|
||||
|
||||
RUN corepack enable && \
|
||||
corepack prepare pnpm@9.15.9 --activate
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# 克隆并构建 2024 主题
|
||||
ARG FRONTEND_2024_REPO=https://git.orionc.me/orion/FileCodeBoxFronted.git
|
||||
ARG FRONTEND_2024_BRANCH=main
|
||||
ARG FRONTEND_CACHE_BUST=1
|
||||
RUN echo "$FRONTEND_CACHE_BUST" >/tmp/frontend-cache-bust && \
|
||||
git clone --filter=blob:none --no-checkout "$FRONTEND_2024_REPO" /build/fronted-2024 && \
|
||||
cd /build/fronted-2024 && \
|
||||
git fetch --depth 1 origin "${FRONTEND_2024_REF}" && \
|
||||
git checkout --detach FETCH_HEAD && \
|
||||
pnpm install --frozen-lockfile --prod=false && \
|
||||
VITE_GIT_COMMIT="$(git rev-parse HEAD)" pnpm run build
|
||||
|
||||
# 克隆并构建定制 2026 主题
|
||||
ARG FRONTEND_2026_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2026.git
|
||||
ARG FRONTEND_2026_BRANCH=test/custom-admin-ui
|
||||
RUN echo "$FRONTEND_CACHE_BUST" >/tmp/frontend-2026-cache-bust && \
|
||||
git clone --depth 1 --branch "$FRONTEND_2026_BRANCH" "$FRONTEND_2026_REPO" /build/fronted-2026 && \
|
||||
cd /build/fronted-2026 && \
|
||||
pnpm install --frozen-lockfile --prod=false && \
|
||||
VITE_GIT_COMMIT="$(git rev-parse HEAD)" pnpm run build
|
||||
|
||||
# 克隆并构建 2023 主题
|
||||
ARG FRONTEND_2023_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2023.git
|
||||
ARG FRONTEND_2023_BRANCH=main
|
||||
RUN git clone --filter=blob:none --no-checkout "$FRONTEND_2023_REPO" /build/fronted-2023 && \
|
||||
cd /build/fronted-2023 && \
|
||||
git fetch --depth 1 origin "${FRONTEND_2023_REF}" && \
|
||||
git checkout --detach FETCH_HEAD && \
|
||||
npm install --legacy-peer-deps && \
|
||||
npm run build
|
||||
|
||||
# 第二阶段:构建最终镜像
|
||||
FROM python:3.12-slim-bookworm
|
||||
ARG APP_VERSION
|
||||
ARG VCS_REF=unknown
|
||||
ARG FRONTEND_2024_REF=main
|
||||
ARG FRONTEND_2023_REF=main
|
||||
LABEL author="Lan"
|
||||
LABEL email="xzu@live.com"
|
||||
LABEL org.opencontainers.image.version="${APP_VERSION}"
|
||||
LABEL org.opencontainers.image.revision="${VCS_REF}"
|
||||
LABEL org.opencontainers.image.filecodebox.frontend-2024-revision="${FRONTEND_2024_REF}"
|
||||
LABEL org.opencontainers.image.filecodebox.frontend-2023-revision="${FRONTEND_2023_REF}"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 复制项目文件(通过 .dockerignore 排除不必要的文件)
|
||||
COPY . .
|
||||
|
||||
# 分支镜像使用带提交号的开发版本;正式镜像使用 VERSION 中的版本。
|
||||
ENV APP_VERSION="${APP_VERSION}"
|
||||
|
||||
# 设置时区
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||||
echo 'Asia/Shanghai' > /etc/timezone
|
||||
|
||||
# 从构建阶段复制编译好的前端主题
|
||||
COPY --from=frontend-builder /build/fronted-2024/dist ./themes/2024
|
||||
COPY --from=frontend-builder /build/fronted-2026/dist ./themes/2026
|
||||
COPY --from=frontend-builder /build/fronted-2023/dist ./themes/2023
|
||||
|
||||
# 应用管理后台详情页取件记录展开/收起、复制回退与悬停边框补丁
|
||||
RUN python scripts/patch_admin_timeline_ui.py
|
||||
|
||||
# 安装系统安全更新 + Python 依赖
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y --no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& pip install --no-cache-dir -r requirements.txt \
|
||||
&& pip cache purge || true
|
||||
|
||||
|
||||
# 环境变量配置
|
||||
ENV HOST="0.0.0.0" \
|
||||
PORT=12345 \
|
||||
WORKERS=1 \
|
||||
LOG_LEVEL="info" \
|
||||
FORWARDED_ALLOW_IPS=""
|
||||
|
||||
EXPOSE 12345
|
||||
|
||||
# 生产环境启动命令
|
||||
# FORWARDED_ALLOW_IPS 由部署环境显式指定,避免任意客户端伪造 X-Forwarded-*。
|
||||
CMD ["sh", "-c", "exec uvicorn main:app --host \"$HOST\" --port \"$PORT\" --workers \"$WORKERS\" --log-level \"$LOG_LEVEL\" --proxy-headers --forwarded-allow-ips \"${FORWARDED_ALLOW_IPS:-}\""]
|
||||
Reference in new issue
Block a user