dev #5

Merged
zhangxiang merged 159 commits from dev into main 2026-04-12 17:39:08 +08:00
3 changed files with 8 additions and 13 deletions
Showing only changes of commit bd87cdf0e6 - Show all commits
+4 -3
View File
@@ -7,10 +7,11 @@ ENV PORT=3000
ENV HOSTNAME="0.0.0.0" ENV HOSTNAME="0.0.0.0"
RUN addgroup --system --gid 1001 nodejs && \ RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs adduser --system --uid 1001 nextjs && \
apk add --no-cache curl
COPY dist/standalone ./ COPY dist/standalone/novalon-website/ ./
COPY dist/static ./dist/static COPY dist/static/ ./.next/static/
COPY public ./public COPY public ./public
RUN chown -R nextjs:nodejs /app RUN chown -R nextjs:nodejs /app
+1 -7
View File
@@ -18,19 +18,13 @@ services:
- ./data:/app/data - ./data:/app/data
- ./uploads:/app/uploads - ./uploads:/app/uploads
healthcheck: healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/api/health"] test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
interval: 30s interval: 30s
timeout: 10s timeout: 10s
retries: 3 retries: 3
start_period: 40s start_period: 40s
networks:
- novalon-network
logging: logging:
driver: "json-file" driver: "json-file"
options: options:
max-size: "10m" max-size: "10m"
max-file: "3" max-file: "3"
networks:
novalon-network:
external: true
+3 -3
View File
@@ -16,7 +16,7 @@ echo ""
echo "=== Step 1: 备份当前版本 ===" echo "=== Step 1: 备份当前版本 ==="
mkdir -p $BACKUP_DIR mkdir -p $BACKUP_DIR
if [ -d "dist" ]; then if [ -d "dist" ]; then
tar -czf $BACKUP_DIR/dist_$TIMESTAMP.tar.gz dist public package.json package-lock.json 2>/dev/null || echo "备份完成(部分文件可能不存在)" 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 "备份完成(部分文件可能不存在)"
echo "✅ 备份已保存到: $BACKUP_DIR/dist_$TIMESTAMP.tar.gz" echo "✅ 备份已保存到: $BACKUP_DIR/dist_$TIMESTAMP.tar.gz"
else else
echo "⚠️ 没有找到dist目录,跳过备份" echo "⚠️ 没有找到dist目录,跳过备份"
@@ -48,7 +48,7 @@ sleep 10
echo "" echo ""
echo "=== Step 6: 健康检查 ===" echo "=== Step 6: 健康检查 ==="
for i in {1..30}; do for i in {1..30}; do
if wget -q --spider http://localhost:3000/api/health 2>/dev/null; then if curl -f http://localhost:3000/api/health >/dev/null 2>&1; then
echo "✅ 健康检查通过!" echo "✅ 健康检查通过!"
echo "" echo ""
@@ -75,7 +75,7 @@ if [ -f "$BACKUP_DIR/dist_$TIMESTAMP.tar.gz" ]; then
docker-compose down docker-compose down
docker-compose up -d docker-compose up -d
sleep 10 sleep 10
if wget -q --spider http://localhost:3000/api/health 2>/dev/null; then if curl -f http://localhost:3000/api/health >/dev/null 2>&1; then
echo "✅ 回滚成功" echo "✅ 回滚成功"
else else
echo "❌ 回滚也失败了!" echo "❌ 回滚也失败了!"