|
|
||
|---|---|---|
| .github/workflows | ||
| .sqlx | ||
| src | ||
| .dockerignore | ||
| .env | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Dockerfile | ||
| README.md | ||
Mapp Tile Service
一个基于Rust的瓦片地图服务,提供图像缓存和数据库查询功能。
🐳 Docker 部署
本地构建
# 构建镜像
docker build -t mapp-tile:latest .
# 运行容器
docker run -p 3000:3000 --env-file .env mapp-tile:latest
使用构建脚本
# 给脚本执行权限
chmod +x docker-build.sh
# 运行构建脚本
./docker-build.sh
🚀 GitHub Actions
本项目配置了以下GitHub Actions工作流:
1. Docker构建和推送 (docker.yml)
- 在推送到main/master分支时自动构建Docker镜像
- 支持多平台构建(amd64, arm64)
- 自动推送到GitHub Container Registry
- 支持语义化版本标签
2. 测试 (test.yml)
- 运行Rust项目的单元测试
- 代码格式检查
- Clippy静态分析
- 包含PostgreSQL服务用于集成测试
3. 安全扫描 (security.yml)
- 依赖漏洞扫描(cargo audit)
- 许可证检查(cargo-deny)
- 容器镜像安全扫描(Trivy)
- 每周自动运行
📋 环境变量
创建 .env 文件并配置以下环境变量:
DATABASE_URL=postgresql://username:password@localhost:5432/database
LOCAL_OSS=https://your-oss-endpoint.com
🔧 开发
本地运行
# 安装依赖
cargo build
# 运行开发服务器
cargo run
测试
# 运行测试
cargo test
# 运行Clippy检查
cargo clippy
# 检查代码格式
cargo fmt --check
📦 镜像标签说明
latest: 最新版本main: main分支的最新构建v1.0.0: 语义化版本标签sha-abc123: 基于提交哈希的标签
🔍 健康检查
服务提供健康检查端点:
curl http://localhost:3000/api/v1/health
<EFBFBD><EFBFBD> 许可证
MIT License