This commit is contained in:
25
build.sh
Normal file
25
build.sh
Normal 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"
|
||||
Reference in New Issue
Block a user