Repository navigation
chore(deploy): M6 Docker Compose 部署与构建期 gzip 预压缩 - #16
Merged
Merged
Conversation
- 后端 Dockerfile:多阶段 rust:1-bookworm → debian:bookworm-slim,先用假入口编依赖以复用层缓存,非 root uid 10001 运行,装 curl 供 healthcheck - 前端 Dockerfile:多阶段 node:24-bookworm-slim → nginx:stable-alpine,VITE_* 经 build.args 注入 - frontend/nginx.conf:/api 读超时 120s(覆盖微信扫码登录 30s 长轮询)、/ws 透传 Upgrade 且读超时 300s、gzip + gzip_static、/assets/ immutable 而 index.html no-cache、SPA 回退,末尾附容器内终结 TLS 注释模板 - docker-compose.yml:只暴露 80(TLS 交前置反代),frontend 以 service_healthy 依赖 backend,mem_limit 512m/128m 对齐 2 核 2G 预算,日志命名卷持久化 - 前端接入 vite-plugin-compression2 生成 .gz 产物(index.js 325KB→101KB) - 根 .env.example、README 部署章节、DESIGN §8、CHANGELOG 同步
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
M6 打磨阶段的部署落地(docs/DESIGN.md §8):Docker Compose 一键部署 + 构建期 gzip 预压缩。
backend/Dockerfile:多阶段rust:1-bookworm→debian:bookworm-slim。先用假入口把依赖编出来,改源码只重编本项目 crate(实测依赖层 13m33s / 源码层 44s);非 rootuid 10001运行,装curl供 healthcheckfrontend/Dockerfile:多阶段node:24-bookworm-slim→nginx:stable-alpine;VITE_*经build.args注入(值取自根.env,仓库只留.env.example模板)frontend/nginx.conf:/api读超时 120s(覆盖微信扫码登录 30s 长轮询)、/ws透传Upgrade且读超时 300s、gzip +gzip_static、/assets/immutable 而index.htmlno-cache、SPA 回退;末尾附容器内终结 TLS 的注释模板docker-compose.yml:对外只暴露 80(TLS 交前置反代),frontend 以service_healthy依赖 backend,mem_limit512m/128m 对齐 2 核 2G 预算,日志命名卷持久化vite-plugin-compression2生成.gz产物(index.js 325KB → 101KB).env.example补部署用法变更类型
chore构建/依赖/杂项目标分支
dev(feature/fix 常规合并)自查清单
chore/deploy),基于最新dev创建cargo fmt --check/clippy -D warnings/cargo test:本次无 Rust 代码改动(CI 仍会执行)lint(0 警告)/tsc/ 63 测试 / 构建 全部通过.env.example)unwrap()、无unsafe、无anymem_limit,不影响 WS 房间资源上限逻辑)关联 issue / 备注
本机已实跑验证(
docker compose build+up -d):Up (healthy);GET /api/health经 nginx 返回200 {"code":0,...,"status":"up"}/assets/index-*.js返回Content-Encoding: gzip、Content-Length: 100955(预压缩 .gz 直出)、Cache-Control: public, max-age=31536000, immutable/index.html为Cache-Control: no-cache;/r/12345SPA 回退 200;/ws未登录握手 401env_file注入生效:/api/wechat/status返回{"available":true}uid=10001(app),/app/logs由命名卷挂载且可写docker compose down -v清理有意未包含:容器内终结 TLS(按需取消
frontend/nginx.conf末尾注释并打开 443 端口);CI 暂未加入 docker build 步骤。