增加构建缓存
Some checks failed
构建并运行 Docker / build (push) Failing after 23s

This commit is contained in:
2025-07-29 14:22:54 +08:00
parent 745360f93f
commit cfdc5e5d9a
4 changed files with 36 additions and 3 deletions

25
build.sh Normal file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# 本地构建脚本 - 包含缓存优化
set -e
echo "🚀 开始构建 Docker 镜像..."
# 清理旧镜像(可选)
# docker system prune -f
# 使用 Buildx 和缓存构建
docker buildx build \
--cache-from type=local,src=/tmp/.buildx-cache \
--cache-to type=local,dest=/tmp/.buildx-cache,mode=max \
--tag watch-stock-list:latest \
--load \
.
echo "✅ 构建完成!"
# 启动容器(可选)
echo "🐳 启动容器..."
docker-compose up -d
echo "🎉 部署完成!应用运行在 http://localhost:7799"