feat: Docker 构建与 Compose、Redis 集成及子路径部署支持#16
Open
hsmustard wants to merge 1 commit intohelloxz:mainfrom
Open
Conversation
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.
变更概述
本 PR 对 Zurl 的部署与运行方式做了以下改进:
Docker 构建
python:3.12-slim,在镜像内使用 Node.js/pnpm 构建前端,构建完成后移除前端源码与 Node 以缩小镜像体积。BASE_URL在构建时指定前端静态资源与 API 的根路径,便于子路径部署。Docker Compose 与 Redis
docker-compose启动。REDIS_HOST、REDIS_PORT、REDIS_DB、REDIS_PASSWORD连接 Redis;未设置时从config.toml的[redis]读取。run.sh改为仅启动应用进程,Redis 由 Compose 或外部单独提供。子路径部署(BASE_URL)
BASE_URL或配置中的app.BASE_URL设置子路径(如/zurl),静态资源与路由均挂载到该路径下。VITE_BASE_URL(与BASE_URL一致),便于在反向代理后以子路径访问。配置与数据
config.simple.toml增加[redis]与app.BASE_URL示例。urls.is_active为 NULL 的记录设为 1,保证启用/禁用与旧数据兼容。文档
README.md与README_zh.md:安装方式改为推荐使用项目内docker-compose.yaml(含 Redis),并补充 Redis、BASE_URL 的配置说明及子路径部署说明。Summary of Changes
This PR improves how Zurl is built and run:
Docker build
python:3.12-slim. The frontend is built inside the image with Node.js/pnpm; after the build, frontend source and Node are removed to reduce image size.BASE_URLis supported so the frontend and API base path can be set at build time for subpath deployment.Docker Compose and Redis
docker-compose.REDIS_HOST,REDIS_PORT,REDIS_DB,REDIS_PASSWORD; if unset, config is read from[redis]inconfig.toml.run.shnow only starts the app process; Redis is expected to be run by Compose or externally.Subpath deployment (BASE_URL)
/zurl) via envBASE_URLorapp.BASE_URLin config. Static files and routes are mounted under that path.VITE_BASE_URLmatchingBASE_URLso the app can be served under a subpath behind a reverse proxy.Config and data
config.simple.tomlincludes[redis]andapp.BASE_URLexamples.urls.is_active = 1where it was NULL for legacy data, so enable/disable behavior stays compatible.Docs
README.mdandREADME_zh.mdare updated: installation now recommends the project’sdocker-compose.yaml(with Redis) and document Redis, BASE_URL, and subpath deployment.