🔧 chore: 同步完整后端运行模块
This commit is contained in:
1 parent
d104b9fc8b
commit
2d44699eec
20 files changed
+1465
-235
No files matched your search
+9
-5
@@ -15,7 +15,8 @@ WORKDIR /build
|
||||
# 克隆并构建 2024 主题
|
||||
ARG FRONTEND_2024_REPO=https://git.orionc.me/orion/FileCodeBoxFronted.git
|
||||
ARG FRONTEND_2024_BRANCH=main
|
||||
ARG FRONTEND_CACHE_BUST=1
|
||||
# 每次更新 2026 前端后,同步为测试分支已验证的提交,避免 Docker 复用过期的远端前端构建层。
|
||||
ARG FRONTEND_CACHE_BUST=f4e498b
|
||||
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 && \
|
||||
@@ -26,7 +27,7 @@ RUN echo "$FRONTEND_CACHE_BUST" >/tmp/frontend-cache-bust && \
|
||||
|
||||
# 克隆并构建定制 2026 主题
|
||||
ARG FRONTEND_2026_REPO=https://git.orionc.me/orion/FileCodeBoxFronted2026.git
|
||||
ARG FRONTEND_2026_BRANCH=test/custom-admin-ui
|
||||
ARG FRONTEND_2026_BRANCH=main
|
||||
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 && \
|
||||
@@ -88,11 +89,14 @@ RUN apt-get update \
|
||||
ENV HOST="0.0.0.0" \
|
||||
PORT=12345 \
|
||||
WORKERS=1 \
|
||||
LOG_LEVEL="info" \
|
||||
APP_ENV="production" \
|
||||
LOG_LEVEL="warning" \
|
||||
ACCESS_LOG="false" \
|
||||
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:-}\""]
|
||||
# FORWARDED_ALLOW_IPS 默认为空:仅信任直连 IP,避免任意客户端伪造 X-Forwarded-*。
|
||||
# 若前面有反向代理,请显式设置为代理网段,例如 "10.0.0.0/8,172.16.0.0/12"。
|
||||
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\" --proxy-headers --forwarded-allow-ips \"${FORWARDED_ALLOW_IPS:-}\""]
|
||||
Reference in new issue
Block a user