fix(docker): adapt Dockerfile.prod for Next.js 16 standalone output structure
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/push/woodpecker Pipeline failed
- Fix standalone path: dist/standalone/novalon-website/ - Update static files path: dist/static - Replace curl with wget in health checks (Alpine compatibility) - Add monitoring and optimization scripts - Configure external network for docker-compose This resolves the deployment failure caused by Next.js 16's new standalone output structure.
This commit is contained in:
@@ -16,7 +16,7 @@ echo ""
|
||||
echo "=== Step 1: 备份当前版本 ==="
|
||||
mkdir -p $BACKUP_DIR
|
||||
if [ -d "dist" ]; then
|
||||
tar -czf $BACKUP_DIR/dist_$TIMESTAMP.tar.gz dist public package.json package-lock.json Dockerfile.prod docker-compose.server.yml 2>/dev/null || echo "备份完成(部分文件可能不存在)"
|
||||
tar -czf $BACKUP_DIR/dist_$TIMESTAMP.tar.gz dist public package.json package-lock.json 2>/dev/null || echo "备份完成(部分文件可能不存在)"
|
||||
echo "✅ 备份已保存到: $BACKUP_DIR/dist_$TIMESTAMP.tar.gz"
|
||||
else
|
||||
echo "⚠️ 没有找到dist目录,跳过备份"
|
||||
@@ -48,7 +48,7 @@ sleep 10
|
||||
echo ""
|
||||
echo "=== Step 6: 健康检查 ==="
|
||||
for i in {1..30}; do
|
||||
if curl -f http://localhost:3000/api/health >/dev/null 2>&1; then
|
||||
if wget -q --spider http://localhost:3000/api/health 2>/dev/null; then
|
||||
echo "✅ 健康检查通过!"
|
||||
|
||||
echo ""
|
||||
@@ -75,7 +75,7 @@ if [ -f "$BACKUP_DIR/dist_$TIMESTAMP.tar.gz" ]; then
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
sleep 10
|
||||
if curl -f http://localhost:3000/api/health >/dev/null 2>&1; then
|
||||
if wget -q --spider http://localhost:3000/api/health 2>/dev/null; then
|
||||
echo "✅ 回滚成功"
|
||||
else
|
||||
echo "❌ 回滚也失败了!"
|
||||
|
||||
Reference in New Issue
Block a user